Use TCP_NODELAY in websocket connection to improve performance

This commit is contained in:
Vangelis Banos 2018-01-25 22:39:32 +00:00
parent c934759852
commit 3b0d1203c3

View File

@ -162,7 +162,8 @@ class WebsockReceiverThread(threading.Thread):
# ping_timeout is used as the timeout for the call to select.select() # 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 # in addition to its documented purpose, and must have a value to avoid
# hangs in certain situations # 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): def _on_message(self, websock, message):
try: try: