Skip to content

@bkad / secret
Last active

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Poller not recognizing there's new data to be read
from twisted.internet import reactor
from autobahn.websocket import WebSocketClientFactory,WebSocketClientProtocol, connectWS
class EchoClientProtocol(WebSocketClientProtocol):
def onOpen(self):
self.sendMessage("1", False)
self.sendMessage("2", False)
if __name__ == '__main__':
factory = WebSocketClientFactory("ws://localhost:8000/echo")
factory.protocol = EchoClientProtocol
from gevent import pywsgi
from geventwebsocket.handler import WebSocketHandler
from select import poll
import select
def websocket_app(environ, start_response):
if environ["PATH_INFO"] == "/echo":
ws = environ["wsgi.websocket"]
poller = poll()
fileno =
poller.register(fileno, select.POLLIN)
while True:
events = dict(poller.poll())
if fileno in events:
data = ws.receive()
print data
server = pywsgi.WSGIServer(("", 8000), websocket_app, handler_class=WebSocketHandler)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.