Renamed package and cleaned code
This commit is contained in:
parent
f6a991ac8f
commit
afa0dc5635
4 changed files with 13 additions and 16 deletions
12
README.rst
12
README.rst
|
|
@ -22,7 +22,7 @@ Installation
|
||||||
source $VIRTUAL_ENV/bin/activate
|
source $VIRTUAL_ENV/bin/activate
|
||||||
|
|
||||||
# Install package
|
# Install package
|
||||||
easy_install -U socketIOClient
|
easy_install -U socketIO-client
|
||||||
|
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
|
|
@ -34,14 +34,14 @@ Activate isolated environment. ::
|
||||||
|
|
||||||
Emit. ::
|
Emit. ::
|
||||||
|
|
||||||
from socketIOClient import SocketIO
|
from socketIO_client import SocketIO
|
||||||
|
|
||||||
socketIO = SocketIO('localhost', 8000)
|
socketIO = SocketIO('localhost', 8000)
|
||||||
socketIO.emit('aaa', {'bbb': 'ccc'})
|
socketIO.emit('aaa', {'bbb': 'ccc'})
|
||||||
|
|
||||||
Emit with callback. ::
|
Emit with callback. ::
|
||||||
|
|
||||||
from socketIOClient import SocketIO
|
from socketIO_client import SocketIO
|
||||||
|
|
||||||
def on_response(arg1, arg2, arg3, arg4):
|
def on_response(arg1, arg2, arg3, arg4):
|
||||||
print arg1, arg2, arg3, arg4
|
print arg1, arg2, arg3, arg4
|
||||||
|
|
@ -52,7 +52,7 @@ Emit with callback. ::
|
||||||
|
|
||||||
Define events. ::
|
Define events. ::
|
||||||
|
|
||||||
from socketIOClient import SocketIO
|
from socketIO_client import SocketIO
|
||||||
|
|
||||||
def on_ddd(arg1, arg2, arg3, arg4):
|
def on_ddd(arg1, arg2, arg3, arg4):
|
||||||
print arg1, arg2, arg3, arg4
|
print arg1, arg2, arg3, arg4
|
||||||
|
|
@ -62,7 +62,7 @@ Define events. ::
|
||||||
|
|
||||||
Define events in a namespace. ::
|
Define events in a namespace. ::
|
||||||
|
|
||||||
from socketIOClient import SocketIO, BaseNamespace
|
from socketIO_client import SocketIO, BaseNamespace
|
||||||
|
|
||||||
class Namespace(BaseNamespace):
|
class Namespace(BaseNamespace):
|
||||||
|
|
||||||
|
|
@ -73,7 +73,7 @@ Define events in a namespace. ::
|
||||||
|
|
||||||
Define standard events. ::
|
Define standard events. ::
|
||||||
|
|
||||||
from socketIOClient import SocketIO, BaseNamespace
|
from socketIO_client import SocketIO, BaseNamespace
|
||||||
|
|
||||||
class Namespace(BaseNamespace):
|
class Namespace(BaseNamespace):
|
||||||
|
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -1,7 +1,7 @@
|
||||||
import os
|
import os
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
from socketIOClient import __version__
|
from socketIO_client import __version__
|
||||||
|
|
||||||
|
|
||||||
here = os.path.abspath(os.path.dirname(__file__))
|
here = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
|
||||||
|
|
@ -105,14 +105,11 @@ class SocketIO(object):
|
||||||
return int(code), packetID, channelName, data
|
return int(code), packetID, channelName, data
|
||||||
|
|
||||||
def _send_packet(self, code, channelName='', data='', callback=None):
|
def _send_packet(self, code, channelName='', data='', callback=None):
|
||||||
try:
|
self.connection.send(':'.join([
|
||||||
self.connection.send(':'.join([
|
str(code),
|
||||||
str(code),
|
self.set_callback(callback) if callback else '',
|
||||||
self.set_callback(callback) if callback else '',
|
channelName,
|
||||||
channelName,
|
data]))
|
||||||
data]))
|
|
||||||
except Exception, e:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def disconnect(self, channelName=''):
|
def disconnect(self, channelName=''):
|
||||||
self._send_packet(0, channelName)
|
self._send_packet(0, channelName)
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from socketIOClient import SocketIO, BaseNamespace
|
from socketIO_client import SocketIO, BaseNamespace
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue