Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix socket options for websocket transport #36

Merged
merged 2 commits into from
Feb 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion asyncio_mqtt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ async def connect(self, *, timeout=10):
loop = asyncio.get_running_loop()
await loop.run_in_executor(None, self._client.connect, self._hostname, self._port, 60)
# paho.mqttClient.socket() return non-None after the call to connect.
self._client.socket().setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 2048)
client_socket = self._client.socket()
if not isinstance(client_socket, mqtt.WebsocketWrapper):
client_socket.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 2048)
# paho.mqtt.Client.connect may raise one of several exceptions.
# We convert all of them to the common MqttError for user convenience.
# See: https://github.com/eclipse/paho.mqtt.python/blob/v1.5.0/src/paho/mqtt/client.py#L1770
Expand Down