| |
- __builtin__.object
-
- SockJSServer
- core.streams.ReadStream(__builtin__.object)
-
- SockJSSocket(core.streams.ReadStream, core.streams.WriteStream)
- core.streams.WriteStream(__builtin__.object)
-
- SockJSSocket(core.streams.ReadStream, core.streams.WriteStream)
- org.vertx.java.core.Handler(java.lang.Object)
-
- org.python.proxies.core.sock_js$SockJSSocketHandler$17(org.vertx.java.core.Handler, java.lang.Object)
-
- SockJSSocketHandler
class SockJSServer(__builtin__.object) |
|
This is an implementation of the server side part of https://github.com/sockjs
SockJS enables browsers to communicate with the server using a simple WebSocket-like api for sending
and receiving messages. Under the bonnet SockJS chooses to use one of several protocols depending on browser
capabilities and what apppears to be working across the network.
Available protocols include:
WebSockets
xhr-polling
xhr-streaming
json-polling
event-source
html-file
This means, it should just work irrespective of what browser is being used, and whether there are nasty
things like proxies and load balancers between the client and the server.
For more detailed information on SockJS, see their website.
On the server side, you interact using instances of SockJSSocket - this allows you to send data to the
client or receive data via the ReadStream data_handler.
You can register multiple applications with the same SockJSServer, each using different path prefixes, each
application will have its own handler, and configuration is described in a Hash. |
|
Methods defined here:
- __init__(self, http_server)
- bridge(self, config, inbound_permitted, outbound_permitted, auth_timeout=300000, auth_address=None)
- install_app(self, config, handler)
- Install an application
Keyword arguments:
@param config: Configuration for the application
@param proc: Proc representing the handler
@param handler: Handler to call when a new SockJSSocket is created
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class SockJSSocket(core.streams.ReadStream, core.streams.WriteStream) |
|
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. |
|
- Method resolution order:
- SockJSSocket
- core.streams.ReadStream
- core.streams.WriteStream
- __builtin__.object
Methods defined here:
- __init__(self, java_sock)
- close(self)
- Close the socket
- 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.
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.
Methods inherited from core.streams.ReadStream:
- data_handler(self, handler)
- Set a data handler. As data is read, the handler will be called with the data.
Keyword arguments:
@param handler: The data handler
- end_handler(self, handler)
- Set an end handler on the stream. Once the stream has ended, and there is no more data to be read, this handler will be called.
Keyword arguments:
@param handler: The exception handler
- exception_handler(self, handler)
- Set an execption handler on the stream.
param [Block] hndlr. The exception handler
- pause(self)
- Pause the ReadStream. After calling this, the ReadStream will aim to send no more data to the
- resume(self)
- Resume reading. If the ReadStream has been paused, reading will recommence on it.
Data descriptors inherited from core.streams.ReadStream:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from core.streams.WriteStream:
- drain_handler(self, handler)
- Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write
queue has been reduced to maxSize / 2. See for an example of this being used.
Keyword arguments:
@param handler: The drain handler
- set_write_queue_max_size(self, size)
- Set the maximum size of the write queue. You will still be able to write to the stream even
if there is more data than this in the write queue. This is used as an indicator by classes such as
to provide flow control.
Keyword arguments:
@param size: The maximum size, in bytes.
- write_buffer(self, buff)
- Write some data to the stream. The data is put on an internal write queue, and the write actually happens
asynchronously. To avoid running out of memory by putting too much on the write queue,
check the method before writing. This is done automatically if using a .
param [Buffer]. The buffer to write.
Data descriptors inherited from core.streams.WriteStream:
- write_queue_full
- Is the write queue full?
return True if there are more bytes in the write queue than the max write queue size.
- write_queue_max_size
|
class SockJSSocketHandler(org.python.proxies.core.sock_js$SockJSSocketHandler$17) |
|
SockJS Socket handler |
|
- Method resolution order:
- SockJSSocketHandler
- org.python.proxies.core.sock_js$SockJSSocketHandler$17
- org.vertx.java.core.Handler
- java.lang.Object
- __builtin__.object
Methods defined here:
- __init__(self, handler)
- handle(self, sock)
- Call the handler after SockJS Socket is ready
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- __initProxy__ = <java function __initProxy__ 0xc0>
- __supernames__ = array('java.lang.String', [u'clone', u'finalize'])
- classDictInit = <java function classDictInit 0xc1>
- clone = <java function clone 0xc2>
- finalize = <java function finalize 0xc3>
Methods inherited from java.lang.Object:
- __copy__(...)
- __deepcopy__(...)
- __eq__(...)
- __hash__(...)
- __ne__(...)
- __repr__(...)
- __unicode__(...)
Data and other attributes inherited from java.lang.Object:
- equals = <java function equals 0xc4>
- getClass = <java function getClass 0xc5>
- hashCode = <java function hashCode 0xc6>
- notify = <java function notify 0xc7>
- notifyAll = <java function notifyAll 0xc8>
- toString = <java function toString 0xc9>
- wait = <java function wait 0xca>
| |