diff --git a/.gitignore b/.gitignore index 15e22ab..6cf8c00 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,9 @@ *~ +*.sw[op] +*.py[cod] +*.egg *.egg-info -*.pyc -*.swo -*.swp -.coverage build dist +sdist +.coverage diff --git a/LICENSE b/LICENSE index 2e7adea..4e68cea 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2012 Roy Hyunjin Han and contributors +Copyright (c) 2013 Roy Hyunjin Han and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/TODO.rst b/TODO.rst index b15199b..4da9fa4 100644 --- a/TODO.rst +++ b/TODO.rst @@ -1,9 +1,14 @@ ++ Identify what needs to be done + + check __init__.py + + check tests.py + + check serve_tests.py + Fix unittests + Fix exceptions when websocket server disappears -Fix thread exceptions - Finish creating low-level _SocketIO to eliminate cyclic references - Move namespace and callback handling to _ListenerThread - ++ Fix thread exceptions + + Finish creating low-level _SocketIO to eliminate cyclic references + + Move namespace and callback handling to _ListenerThread += Resolve pull requests +Resolve issues Integrate Zac's fork #6 Integrate Sajal's fork #7 Integrate Francis's fork #10 diff --git a/socketIO_client/__init__.py b/socketIO_client/__init__.py index 920fa48..e5b50be 100644 --- a/socketIO_client/__init__.py +++ b/socketIO_client/__init__.py @@ -1,15 +1,16 @@ import socket from anyjson import dumps, loads -from threading import Event, Thread +from threading import Thread, Event from time import sleep from urllib import urlopen from websocket import WebSocketConnectionClosedException, create_connection -PROTOCOL = 1 # SocketIO protocol version +PROTOCOL = 1 # socket.io protocol version class BaseNamespace(object): # pragma: no cover + 'Define socket.io behavior' def __init__(self, _socketIO): self._socketIO = _socketIO @@ -138,7 +139,7 @@ class _RhythmicThread(Thread): class _ListenerThread(Thread): - 'Process messages from SocketIO server' + 'Process messages from socket.io server' daemon = True @@ -195,7 +196,6 @@ class _ListenerThread(Thread): get_eventCallback('connect')() def on_heartbeat(self, packetID, get_eventCallback, data): - # get_eventCallback('heartbeat')() pass def on_message(self, packetID, get_eventCallback, data): @@ -207,7 +207,7 @@ class _ListenerThread(Thread): def on_event(self, packetID, get_eventCallback, data): valueByName = loads(data) eventName = valueByName['name'] - eventArguments = valueByName['args'] + eventArguments = valueByName.get('args', []) get_eventCallback(eventName)(*eventArguments) def on_acknowledgment(self, packetID, get_eventCallback, data):