vertx.http.sockjs documentation
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 appears 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
vertx.stream/on-data.
You can register multiple applications with the same SockJSServer,
each using different path prefixes, each application will have its
own handler, and configuration.
bridge
(bridge server app-config inbound-permitted outbound-permitted)
(bridge server app-config inbound-permitted outbound-permitted auth-timeout)
(bridge server app-config inbound-permitted outbound-permitted auth-timeout auth-address)
Install an app which bridges the SockJS server to the event bus
app-config The config for the app
inboundPermitted A list of JSON objects which define permitted matches for inbound (client->server) traffic
outboundPermitted A list of JSON objects which define permitted matches for outbound (server->client) traffic
authTimeout Default time an authorisation will be cached for in the bridge (defaults to 5 minutes)
authAddress Address of auth manager. Defaults to 'vertx.basicauthmanager.authorise'
TODO: better doc
install-app
(install-app server config handler)
Install an application with a handler that will be called when new SockJS sockets are created
TODO: better doc
set-hooks
(set-hooks server & {:as name-handlers})
Set a ```EventBusBridgeHook``` to the server.
name-handlers are six pair of kv, v is implementation of EventBusBridgeHook,
k is keyworkd and meaning is:
:closed The socket has been closed
:send Clent is sending
:publish Client is publishing
:pre-register Called before client registers a handler
:post-register Called after client registers a handler
:unregister Client is unregistering a handler
TODO: better doc
sockjs-server
(sockjs-server http-server)
Create a SockJS server that wraps an HTTP server.