This commit is contained in:
Roy Hyunjin Han 2013-05-08 00:36:09 -07:00
commit 9a13cd5fb7
3 changed files with 5 additions and 7 deletions

View file

@ -67,8 +67,7 @@ Define events in a namespace. ::
print 'on_aaa_response', args
self.emit('bbb')
socketIO = SocketIO('localhost', 8000)
socketIO.define(Namespace)
socketIO = SocketIO('localhost', 8000, Namespace)
socketIO.emit('aaa')
socketIO.wait(seconds=1)
@ -81,8 +80,7 @@ Define standard events. ::
def on_connect(self):
print '[Connected]'
socketIO = SocketIO('localhost', 8000)
socketIO.define(Namespace)
socketIO = SocketIO('localhost', 8000, Namespace)
socketIO.wait(seconds=1)
Define different namespaces on a single socket. ::

View file

@ -9,7 +9,7 @@ CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
setup(
name='socketIO-client',
version='0.4',
version='0.5',
description='A socket.io client library',
long_description=README + '\n\n' + CHANGES,
license='MIT',

View file

@ -87,7 +87,7 @@ class BaseNamespace(object): # pragma: no cover
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
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._namespaceByPath = {}
self.define(BaseNamespace) # Define default namespace
self.define(Namespace)
self._rhythmicThread = _RhythmicThread(
self._socketIO.heartbeatInterval,