Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you can upgrade to or are using JDK 7 I suggest using Vert.x <a href="http://vertx.io/">Vertx.io</a> , use Sockjs on the client side. Vert.x has a complete sockjs server implementation, I ll try to suggest a way to implement this, for the rest please look at the Docs</p> <p>The server implementation could be like this</p> <pre><code> Vertx vertx = Vertx.newVertx(); EventBus eventBus = vertx.eventBus() HttpServer server = vertx.createHttpServer(); JsonArray permitted = new JsonArray(); permitted.add(new JsonObject()); SockJSServer sockJSServer = new DefaultSockJSServer(vertx, server); sockJSServer.bridge(new JsonObject().putString("prefix", "/pusher"), permitted, permitted); server.listen(&lt;some port&gt;); </code></pre> <p>On the client side register a handler like so on document load</p> <pre><code> function () { if (!eb) { eb = new vertx.EventBus("http://&lt;your_host&gt;:&lt;your_port&gt;/pusher"); eb.onopen = function() { console.log("connected") }; eb.onclose = function() { console.log("Not connected"); eb = null; }; } </code></pre> <p>}</p> <p>You can then register a handler to any address - address here can be anything , assume it is "AwesomeNotifications" </p> <pre><code>function subscribe(address) { if (eb) { eb.registerHandler(address, function(msg, replyTo) { console.log("Reply recieved") }); } } </code></pre> <p>Once you have this all set up , you can now push any data from the server to this address using the event bus we created earlier</p> <pre><code>eventBus.publish("AwesomeNotifications", new JsonObject(&lt;some hashmap to serialize&gt;)) </code></pre> <p>Hope this helps</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload