Class socketio.socket

socket.io class

Functions

H.ack (self, pkt) Called when a packet 'ACK' is received
H.connect (self, pkt) Called when a packet 'CONNECT' is received
H.disconnect (self, pkt) Called when a packet 'DISCONNECT' is received
H.event (self, pkt) Called when a packet 'EVENT' is received
H.error (self, pkt) Called when a packet 'ERROR' is received
C.new (manager, path, opts) Class constructor.

Methods

socketio.socket:on_packet (self, pkt) Called when a packet is received for the given path/namespace.
socketio.socket:connect (self) Connect to the socket path.
socketio.socket:disconnect (self) Disconnect to the socket path.
socketio.socket:on (self, name, func) Registers or unregisters an event.
socketio.socket:once (self, name, func) Registers an event once.
socketio.socket:emit (self, name, ...) Emit an event to the socket.io server.
socketio.socket:send (self, ...) Send a message.
socketio.socket:_fire (self, name, ...) Fire an event for the socket.


Functions

H.ack (self, pkt)
Called when a packet 'ACK' is received

Parameters:

  • self instance
  • pkt Packet 'ACK'.
H.connect (self, pkt)
Called when a packet 'CONNECT' is received

Parameters:

  • self instance
  • pkt Packet 'CONNECT'.
H.disconnect (self, pkt)
Called when a packet 'DISCONNECT' is received

Parameters:

  • self instance
  • pkt Packet 'DISCONNECT'.
H.event (self, pkt)
Called when a packet 'EVENT' is received

Parameters:

  • self instance
  • pkt Packet 'EVENT'.
H.error (self, pkt)
Called when a packet 'ERROR' is received

Parameters:

  • self instance
  • pkt Packet 'ERROR'.
C.new (manager, path, opts)
Class constructor.

Parameters:

Returns:

    An instance of socketio.socket.

Methods

socketio.socket:on_packet (self, pkt)
Called when a packet is received for the given path/namespace.

Parameters:

  • self instance
  • pkt Packet for the given socket.
socketio.socket:connect (self)
Connect to the socket path. This will notify the server events from this namespace should be sent to the given socket.

Parameters:

  • self instance
socketio.socket:disconnect (self)
Disconnect to the socket path.

Parameters:

  • self instance
socketio.socket:on (self, name, func)
Registers or unregisters an event.

Parameters:

  • self instance
  • name Event's name
  • func Event's function if defined. 'nil' will unregister a previous registered function.
socketio.socket:once (self, name, func)
Registers an event once. Behaves will socketio.socket.on but will unregisters the event automatically before being called, therefore only fireable once.

Parameters:

  • self instance
  • name Event's name
  • func Event's function to be called once.
socketio.socket:emit (self, name, ...)
Emit an event to the socket.io server.

Parameters:

  • self instance
  • name Event's name.
  • ... Arguments of event. If one callback (and only one) is defined in this arguments, the server will be asked to acknowledge the reception of the message, acknowledgement which will call the given function.
socketio.socket:send (self, ...)
Send a message. This is strictly equivalent to 'emit("message", ...)'. This is commonly used as an emulation of a websocket.

Parameters:

  • self instance
  • ... Message's arguments.
socketio.socket:_fire (self, name, ...)
Fire an event for the socket.

Parameters:

  • self instance
  • name Event's name.
  • ... Event's arguments.
generated by LDoc 1.4.5 Last updated 2016-11-04 14:27:48