wotpy.protocols.ws.handler

Class that handles incoming WebSockets messages.

Classes

WebsocketHandler(*args, **kwargs) Tornado handler for Websocket messages.
class wotpy.protocols.ws.handler.WebsocketHandler(*args, **kwargs)

Bases: tornado.websocket.WebSocketHandler

Tornado handler for Websocket messages. This class processes all incoming WebSocket messages and translates them to actions executed on ExposedThing objects.

POLICY_VIOLATION_CODE = 1008
POLICY_VIOLATION_REASON = 'Not found'
check_origin(origin)

Should return True to accept the request or False to reject it. The origin argument is the value of the Origin HTTP header, the url responsible for initiating this request

exposed_thing

Exposed thing property. Retrieves the ExposedThing from the parent server.

on_close()

Called when the WebSockets connection is closed.

on_message(message)

Called each time the server receives a WebSockets message. All messages that do not conform to the protocol are discarded.

open(name)

Called when the WebSockets connection is opened.