Reviewed code
This commit is contained in:
parent
4f39d1f922
commit
187c6fbca1
4 changed files with 20 additions and 14 deletions
9
.gitignore
vendored
9
.gitignore
vendored
|
|
@ -1,8 +1,9 @@
|
|||
*~
|
||||
*.sw[op]
|
||||
*.py[cod]
|
||||
*.egg
|
||||
*.egg-info
|
||||
*.pyc
|
||||
*.swo
|
||||
*.swp
|
||||
.coverage
|
||||
build
|
||||
dist
|
||||
sdist
|
||||
.coverage
|
||||
|
|
|
|||
2
LICENSE
2
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:
|
||||
|
||||
|
|
|
|||
13
TODO.rst
13
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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue