Skip to content
campadrenalin edited this page Sep 15, 2011 · 1 revision

ConcurrenTree.util.server.websocket

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.

WebSocket

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.

WebSocketServer

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.

Pylib Server
Python Library

Clone this wiki locally