Renamed package and cleaned code

This commit is contained in:
Roy Hyunjin Han 2012-08-09 08:16:48 -04:00
commit afa0dc5635
4 changed files with 13 additions and 16 deletions

View file

@ -22,7 +22,7 @@ Installation
source $VIRTUAL_ENV/bin/activate
# Install package
easy_install -U socketIOClient
easy_install -U socketIO-client
Usage
@ -34,14 +34,14 @@ Activate isolated environment. ::
Emit. ::
from socketIOClient import SocketIO
from socketIO_client import SocketIO
socketIO = SocketIO('localhost', 8000)
socketIO.emit('aaa', {'bbb': 'ccc'})
Emit with callback. ::
from socketIOClient import SocketIO
from socketIO_client import SocketIO
def on_response(arg1, arg2, arg3, arg4):
print arg1, arg2, arg3, arg4
@ -52,7 +52,7 @@ Emit with callback. ::
Define events. ::
from socketIOClient import SocketIO
from socketIO_client import SocketIO
def on_ddd(arg1, arg2, arg3, arg4):
print arg1, arg2, arg3, arg4
@ -62,7 +62,7 @@ Define events. ::
Define events in a namespace. ::
from socketIOClient import SocketIO, BaseNamespace
from socketIO_client import SocketIO, BaseNamespace
class Namespace(BaseNamespace):
@ -73,7 +73,7 @@ Define events in a namespace. ::
Define standard events. ::
from socketIOClient import SocketIO, BaseNamespace
from socketIO_client import SocketIO, BaseNamespace
class Namespace(BaseNamespace):

View file

@ -1,7 +1,7 @@
import os
from setuptools import setup, find_packages
from socketIOClient import __version__
from socketIO_client import __version__
here = os.path.abspath(os.path.dirname(__file__))

View file

@ -105,14 +105,11 @@ class SocketIO(object):
return int(code), packetID, channelName, data
def _send_packet(self, code, channelName='', data='', callback=None):
try:
self.connection.send(':'.join([
str(code),
self.set_callback(callback) if callback else '',
channelName,
data]))
except Exception, e:
pass
self.connection.send(':'.join([
str(code),
self.set_callback(callback) if callback else '',
channelName,
data]))
def disconnect(self, channelName=''):
self._send_packet(0, channelName)

View file

@ -1,4 +1,4 @@
from socketIOClient import SocketIO, BaseNamespace
from socketIO_client import SocketIO, BaseNamespace
from time import sleep
from unittest import TestCase