bibliopixel.drivers.SimPixel.SimpleWebSocketServer module

class bibliopixel.drivers.SimPixel.SimpleWebSocketServer.WebSocket(server, sock, address)[source]

Bases: object

close(status=1000, reason='')[source]

Send Close frame to the client. The underlying socket is only closed when the client acknowledges the Close frame.

status is the closing identifier. reason is the reason for the close.

handleClose()[source]

Called when a websocket server gets a Close frame from a client.

handleConnected()[source]

Called when a websocket client connects to the server.

handleMessage()[source]

Called when websocket frame is received. To access the frame data call self.data.

If the frame is Text then self.data is a unicode object. If the frame is Binary then self.data is a bytearray object.

sendFragment(data)[source]

see sendFragmentStart()

If data is a unicode object then the frame is sent as Text. If the data is a bytearray object then the frame is sent as Binary.

sendFragmentEnd(data)[source]

see sendFragmentEnd()

If data is a unicode object then the frame is sent as Text. If the data is a bytearray object then the frame is sent as Binary.

sendFragmentStart(data)[source]

Send the start of a data fragment stream to a websocket client. Subsequent data should be sent using sendFragment(). A fragment stream is completed when sendFragmentEnd() is called.

If data is a unicode object then the frame is sent as Text. If the data is a bytearray object then the frame is sent as Binary.

sendMessage(data)[source]

Send websocket data frame to the client.

If data is a unicode object then the frame is sent as Text. If the data is a bytearray object then the frame is sent as Binary.

class bibliopixel.drivers.SimPixel.SimpleWebSocketServer.SimpleWebSocketServer(host, port, websocketclass, selectInterval=0.1, **kwargs)[source]

Bases: object

close()[source]
serveforever()[source]