-
Notifications
You must be signed in to change notification settings - Fork 5
Pylib Websocket
campadrenalin edited this page Sep 15, 2011
·
1 revision
The Websocket server is very basic, since it's actually written for general purpose by the community, most specifically Mumrah, and then just modified a bit to work with ServerPools. However, it's not too difficult to map out some documentation for it. Most likely you're going to want to start with the Orchard implementation if you want it as a PoolServer, and work your way from there for your own uses.
Represents a WS connection to a remote endpoint.
Methods:
* __init__(client, server) # Takes a socket and a WebSocketServer.
* feed(data) # input raw data to buffer, trigger other functions as necessary.
* onmessage(data) # function to call when a full message is received.
* onsweep() # function to be called every time server cycles through connections.
* send(data) # send data to remote end as a single, complete message.
* close() # close this connection.
Hosts a server on a socket address of your choice.
Methods:
* __init__(bind, port, cls) # Should generally be "localhost", 8081, and WebSocket.
* listen(backlog=5) # Host the server.
Properties:
* queue # a Queue.Queue the server uses to publish new connections on.