Headlands Firehose Edition Is Available

Datetime:2016-08-22 22:31:58         Topic: WebSocket          Share        Original >>
Here to See The Original Article!!!

The "Firehose" release (v0.0.4) headlands (a JCache based in-memory grid) delivers CacheEntryEvent s via WebSockets in JSON-format.

Cache change events can be received in real-time from Javaclients:

import javax.websocket.ContainerProvider;
import javax.websocket.DeploymentException;
import javax.websocket.WebSocketContainer;

public class NotificationsReceiver extends Endpoint {

    public void onOpen(Session session, EndpointConfig ec) {
        this.session = session;
        this.session.addMessageHandler(new MessageHandler.Whole<String>() {

            public void onMessage(String msg) {


WebSocketContainer containerProvider = ContainerProvider.getWebSocketContainer();
NotificationsReceiver messagesEndpoint = new NotificationsReceiver();
containerProvider.connectToServer(this.messagesEndpoint, new URI("ws://localhost:8080/headlands/firehose/" + channel));
...or JavaScript:

   this.callback = function(payload){

  let socket = new WebSocket(`ws://${this.uri}/headlands/firehose/*`);
   socket.onmessage =  (event) => {
   socket.onopen = (event) => {
     console.log("socket connection established",event);

See you at: Building HTML 5 Applications with react.js and Java EE 7 workshops at MUC Airport !

NEW workshop:On demand workshops:,,andare available for streaming


Put your ads here, just $200 per month.