Fixes #17
This commit is contained in:
parent
01f1d0d06c
commit
9a13cd5fb7
3 changed files with 5 additions and 7 deletions
|
|
@ -67,8 +67,7 @@ Define events in a namespace. ::
|
||||||
print 'on_aaa_response', args
|
print 'on_aaa_response', args
|
||||||
self.emit('bbb')
|
self.emit('bbb')
|
||||||
|
|
||||||
socketIO = SocketIO('localhost', 8000)
|
socketIO = SocketIO('localhost', 8000, Namespace)
|
||||||
socketIO.define(Namespace)
|
|
||||||
socketIO.emit('aaa')
|
socketIO.emit('aaa')
|
||||||
socketIO.wait(seconds=1)
|
socketIO.wait(seconds=1)
|
||||||
|
|
||||||
|
|
@ -81,8 +80,7 @@ Define standard events. ::
|
||||||
def on_connect(self):
|
def on_connect(self):
|
||||||
print '[Connected]'
|
print '[Connected]'
|
||||||
|
|
||||||
socketIO = SocketIO('localhost', 8000)
|
socketIO = SocketIO('localhost', 8000, Namespace)
|
||||||
socketIO.define(Namespace)
|
|
||||||
socketIO.wait(seconds=1)
|
socketIO.wait(seconds=1)
|
||||||
|
|
||||||
Define different namespaces on a single socket. ::
|
Define different namespaces on a single socket. ::
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -9,7 +9,7 @@ CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='socketIO-client',
|
name='socketIO-client',
|
||||||
version='0.4',
|
version='0.5',
|
||||||
description='A socket.io client library',
|
description='A socket.io client library',
|
||||||
long_description=README + '\n\n' + CHANGES,
|
long_description=README + '\n\n' + CHANGES,
|
||||||
license='MIT',
|
license='MIT',
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ class BaseNamespace(object): # pragma: no cover
|
||||||
|
|
||||||
class SocketIO(object):
|
class SocketIO(object):
|
||||||
|
|
||||||
def __init__(self, host, port, secure=False, headers=None, proxies=None):
|
def __init__(self, host, port, Namespace=BaseNamespace, secure=False, headers=None, proxies=None):
|
||||||
"""
|
"""
|
||||||
Create a socket.io client that connects to a socket.io server
|
Create a socket.io client that connects to a socket.io server
|
||||||
at the specified host and port. Set secure=True to use HTTPS / WSS.
|
at the specified host and port. Set secure=True to use HTTPS / WSS.
|
||||||
|
|
@ -97,7 +97,7 @@ class SocketIO(object):
|
||||||
"""
|
"""
|
||||||
self._socketIO = _SocketIO(host, port, secure, headers, proxies)
|
self._socketIO = _SocketIO(host, port, secure, headers, proxies)
|
||||||
self._namespaceByPath = {}
|
self._namespaceByPath = {}
|
||||||
self.define(BaseNamespace) # Define default namespace
|
self.define(Namespace)
|
||||||
|
|
||||||
self._rhythmicThread = _RhythmicThread(
|
self._rhythmicThread = _RhythmicThread(
|
||||||
self._socketIO.heartbeatInterval,
|
self._socketIO.heartbeatInterval,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue