Merge pull request #82 from vbanos/websock-tcp-nodely

Use TCP_NODELAY in websocket connection to improve performance
This commit is contained in:
Noah Levitt 2018-01-26 12:14:44 -08:00 committed by GitHub
commit 0e17205e17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -162,7 +162,8 @@ class WebsockReceiverThread(threading.Thread):
# ping_timeout is used as the timeout for the call to select.select()
# in addition to its documented purpose, and must have a value to avoid
# hangs in certain situations
self.websock.run_forever(ping_timeout=0.5)
self.websock.run_forever(sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY, 1),),
ping_timeout=0.5)
def _on_message(self, websock, message):
try: