This commit is contained in:
liris
2014-11-10 09:19:27 +09:00
parent 3a46a197a8
commit 70d0aea753
2 changed files with 4 additions and 2 deletions

View File

@@ -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

View File

@@ -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):