Events

class lomond.events.BackOff(delay)

Generated when a persistent connection has to wait before re- attempting a connection.

Parameters:delay (float) – The delay (in seconds) before Lomond will re- attempt to connect.
class lomond.events.Binary(data)

Generated when Lomond receives a binary message from the server.

Parameters:data (bytes) – The binary payload.
class lomond.events.Closed(code, reason)

Generated when the websocket was closed. The websocket may no longer send packets after this event has been received.

Parameters:
  • code – The closed code returned from the server.
  • reason (str) – An optional description why the websocket was closed, as returned from the server.
class lomond.events.ConnectFail(reason)

Generate when Lomond was unable to connect to a Websocket server.

Parameters:reason (str) – A short description of the reason for the failure.
class lomond.events.Connected(url)

Generated when Lomond has connected to a server but not yet negotiated the websocket upgrade.

class lomond.events.Connecting(url)

Generated prior to establishing a websocket connection to a server.

Parameters:url – The websocket URL the websocket is connecting to.
class lomond.events.Disconnected(reason=u'closed', graceful=False)

Generated when a websocket connection has been dropped.

Parameters:
  • reason (str) – A description of why the websocket was closed.
  • graceful (bool) – Flag indicating if the connection was dropped gracefully (True), or disconnected due to a socket failure (False).
class lomond.events.Event

Base class for a websocket ‘event’.

class lomond.events.Ping(data)

Generated when Lomond received a ping packet from the server.

Parameters:data (bytes) – Ping payload data.
class lomond.events.Poll

A generated poll event.

class lomond.events.Pong(data)

Generated when Lomond receives a pong packet from the server.

Parameters:data (bytes) – The pong payload data.
class lomond.events.Ready(response, protocol, extensions)

Generated when Lomond has connected to the server, and successfully negotiated the websocket upgrade.

Parameters:
  • response – A Response object.
  • protocol (str) – A websocket protocol or None if no protocol was supplied.
  • extensions (set) – A set of negotiated websocket extensions. Currently Lomond does not support any extensions, so this will be an empty set.
class lomond.events.Rejected(response, reason)

Server rejected WS connection.

class lomond.events.Text(text)

Generated when Lomond receives a text message from the server.

Parameters:text (str) – The text payload.
class lomond.events.UnknownMessage(message)

An application message was received, with an unknown opcode.