fix #126
This commit is contained in:
@@ -6,6 +6,7 @@ ChangeLog
|
||||
- Fix not thread-safe of Websocket.close() (#120)
|
||||
- Try to get proxy info from environment if not explicitly provided (#124)
|
||||
- support proxy basic authenticaiton. (#125)
|
||||
- Fix NoneType exception at WebsocketApp.send (#126)
|
||||
|
||||
- 0.21.0
|
||||
|
||||
|
@@ -94,7 +94,7 @@ class WebSocketApp(object):
|
||||
opcode: operation code of data. default is OPCODE_TEXT.
|
||||
"""
|
||||
|
||||
if self.sock.send(data, opcode) == 0:
|
||||
if not self.sock or self.sock.send(data, opcode) == 0:
|
||||
raise WebSocketConnectionClosedException()
|
||||
|
||||
def close(self):
|
||||
@@ -108,7 +108,8 @@ class WebSocketApp(object):
|
||||
def _send_ping(self, interval, event):
|
||||
while not event.wait(interval):
|
||||
self.last_ping_tm = time.time()
|
||||
self.sock.ping()
|
||||
if self.sock:
|
||||
self.sock.ping()
|
||||
|
||||
def run_forever(self, sockopt=None, sslopt=None, ping_interval=0, ping_timeout=None,
|
||||
http_proxy_host=None, http_proxy_port=None):
|
||||
|
Reference in New Issue
Block a user