Added exception handling to destructor in case of connection failure
This commit is contained in:
parent
128552180e
commit
1f8fc10661
4 changed files with 12 additions and 5 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
0.1
|
0.1.1
|
||||||
---
|
-----
|
||||||
|
- Added exception handling to destructor in case of connection failure
|
||||||
|
|
||||||
|
0.1.0
|
||||||
|
-----
|
||||||
- Wrapped code from `StackOverflow <http://stackoverflow.com/questions/6692908/formatting-messages-to-send-to-socket-io-node-js-server-from-python-client/>`_
|
- Wrapped code from `StackOverflow <http://stackoverflow.com/questions/6692908/formatting-messages-to-send-to-socket-io-node-js-server-from-python-client/>`_
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -10,7 +10,7 @@ CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='socketIO-client',
|
name='socketIO-client',
|
||||||
version='0.1',
|
version='0.1.1',
|
||||||
description='Barebones socket.io client library',
|
description='Barebones socket.io client library',
|
||||||
long_description=README + '\n\n' + CHANGES,
|
long_description=README + '\n\n' + CHANGES,
|
||||||
license='MIT',
|
license='MIT',
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,11 @@ class SocketIO(object):
|
||||||
self.connection = create_connection('ws://%s:%d/socket.io/1/websocket/%s' % (self.host, self.port, self.sessionID))
|
self.connection = create_connection('ws://%s:%d/socket.io/1/websocket/%s' % (self.host, self.port, self.sessionID))
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
self.heartbeatThread.cancel()
|
try:
|
||||||
self.connection.close()
|
self.heartbeatThread.cancel()
|
||||||
|
self.connection.close()
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
def __send_heartbeat(self):
|
def __send_heartbeat(self):
|
||||||
self.connection.send('2::')
|
self.connection.send('2::')
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue