Package core :: Module sock_js :: Class SockJSSocket

[hide private]
[frames] | no frames]

# Class SockJSSocket

source code

             object --+
                      |
     streams.ReadStream --+
                          |
             object --+   |
                      |   |
    streams.WriteStream --+
                          |
                         SockJSSocket

You interact with SockJS clients through instances of SockJS socket. The API is very similar to WebSocket. It implements both ReadStream and WriteStream so it can be used with Pump to enable flow control.

Instance Methods | [hide private]

__init__(self, java_sock) | source code

close(self) Close the socket | source code

handler_id(self) When a SockJSSocket is created it automatically registers an event handler with the system, the ID of that handler is given by handler_id. | source code

_to_java_socket(self) | source code

Inherited from `streams.ReadStream`: `data_handler`, `end_handler`, `exception_handler`, `pause`, `resume` Inherited from `streams.ReadStream` (private): `_to_read_stream` Inherited from `streams.WriteStream`: `drain_handler`, `set_write_queue_max_size`, `write_buffer`, `write_queue_full` Inherited from `streams.WriteStream` (private): `_to_write_stream`

Class Variables | [hide private]

Inherited from `streams.WriteStream`: `write_queue_max_size`

Method Details | [hide private]

### __init__(self, java_sock)
(Constructor)

source code

Overrides: object.__init__
  (inherited documentation)

### handler_id(self)

source code

When a SockJSSocket is created it automatically registers an event handler with the system, the ID of that handler is given by handler_id. Given this ID, a different event loop can send a buffer to that event handler using the event bus. This allows you to write data to other SockJSSockets which are owned by different event loops.