@Override public void send(IWebSocketPushMessage event) { Application application = Application.get(WicketWebInitializer.WICKET_FILTERNAME); WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application); IWebSocketConnectionRegistry connectionRegistry = webSocketSettings.getConnectionRegistry(); Collection<IWebSocketConnection> connections = connectionRegistry.getConnections(application); log.trace("sending event to {} connections", connections.size()); for (IWebSocketConnection connection : connections) { connection.sendMessage(event); } }
public static WebSocketSettings get(Application application) { WebSocketSettings settings = application.getMetaData(KEY); if (settings == null) { synchronized (application) { if (settings == null) { settings = new WebSocketSettings(); set(application, settings); } } } return settings; }
protected CharSequence getBaseUrl(final WebSocketSettings webSocketSettings) { return webSocketSettings.getBaseUrl(); }
this.webRequest = webSocketSettings.newWebSocketRequest(request, wicketFilter.getFilterPath()); this.connectionRegistry = webSocketSettings.getConnectionRegistry(); this.connectionFilter = webSocketSettings.getConnectionFilter();
RequestCycle oldRequestCycle = ThreadContext.getRequestCycle(); WebResponse webResponse = webSocketSettings.newWebSocketResponse(connection); try WebSocketRequestHandler requestHandler = webSocketSettings.newWebSocketRequestHandler(page, connection);
this.webRequest = webSocketSettings.newWebSocketRequest(request, wicketFilter.getFilterPath()); this.connectionRegistry = webSocketSettings.getConnectionRegistry(); this.connectionFilter = webSocketSettings.getConnectionFilter();
RequestCycle oldRequestCycle = ThreadContext.getRequestCycle(); WebResponse webResponse = webSocketSettings.newWebSocketResponse(connection); try WebSocketRequestHandler requestHandler = webSocketSettings.newWebSocketRequestHandler(page, connection);
@Override public void send(IWebSocketPushMessage event) { Application application = Application.get(WicketWebInitializer.WICKET_FILTERNAME); WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application); IWebSocketConnectionRegistry connectionRegistry = webSocketSettings.getConnectionRegistry(); Collection<IWebSocketConnection> connections = connectionRegistry.getConnections(application); log.trace("sending event to {} connections", connections.size()); for (IWebSocketConnection connection : connections) { connection.sendMessage(event); } }
this.webRequest = webSocketSettings.newWebSocketRequest(request, wicketFilter.getFilterPath()); this.connectionRegistry = webSocketSettings.getConnectionRegistry(); this.connectionFilter = webSocketSettings.getConnectionFilter();
RequestCycle oldRequestCycle = ThreadContext.getRequestCycle(); WebResponse webResponse = webSocketSettings.newWebSocketResponse(connection); try WebSocketRequestHandler requestHandler = webSocketSettings.newWebSocketRequestHandler(page, connection);
protected CharSequence getBaseUrl(final WebSocketSettings webSocketSettings) { return webSocketSettings.getBaseUrl(); }
public static WebSocketSettings get(Application application) { WebSocketSettings settings = application.getMetaData(KEY); if (settings == null) { synchronized (application) { if (settings == null) { settings = new WebSocketSettings(); set(application, settings); } } } return settings; }
/** * Broadcasts/pushes a message to all active web socket connections * * @param application * The application where the web socket connection is registered * @param message * The message to broadcast/push */ public void broadcastAll(Application application, IWebSocketPushMessage message) { WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application); WebSocketPushBroadcaster broadcaster = new WebSocketPushBroadcaster(webSocketSettings.getConnectionRegistry()); broadcaster.broadcastAll(application, message); }
/** * Broadcasts/pushes a message to all active web socket connections * * @param application * The application where the web socket connection is registered * @param message * The message to broadcast/push */ public void broadcastAll(Application application, IWebSocketPushMessage message) { WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application); WebSocketPushBroadcaster broadcaster = new WebSocketPushBroadcaster(webSocketSettings.getConnectionRegistry()); broadcaster.broadcastAll(application, message); }
/** * Broadcasts/pushes a message to specific web socket connection * * @param application * The application where the web socket connection is registered * @param sessionId * The id of the http session with which the web socket connection is registered * @param key * The key with which the web socket connection is registered * @param message * The message to broadcast/push */ public void broadcast(Application application, String sessionId, IKey key, IWebSocketPushMessage message) { WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application); WebSocketPushBroadcaster broadcaster = new WebSocketPushBroadcaster(webSocketSettings.getConnectionRegistry()); ConnectedMessage wsMessage = new ConnectedMessage(application, sessionId, key); broadcaster.broadcast(wsMessage, message); }
/** * Load the documents list from the documents folder and synchronizing the list between whiteboard clients */ private void handleDocs() { loadDocuments(); IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry(); for (IWebSocketConnection c : reg.getConnections(Application.get())) { try { JSONArray jsonArray = new JSONArray(); Set<String> keySet = docMap.keySet(); for (String key : keySet) { jsonArray.put(docMap.get(key).get(0)); } c.sendMessage(getDocumentListMessage(jsonArray).toString()); } catch (Exception e) { log.error("Unexpected error while sending message through the web socket", e); } } }
/** * Broadcasts/pushes a message to specific web socket connection * * @param application * The application where the web socket connection is registered * @param sessionId * The id of the http session with which the web socket connection is registered * @param key * The key with which the web socket connection is registered * @param message * The message to broadcast/push */ public void broadcast(Application application, String sessionId, IKey key, IWebSocketPushMessage message) { WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application); WebSocketPushBroadcaster broadcaster = new WebSocketPushBroadcaster(webSocketSettings.getConnectionRegistry()); ConnectedMessage wsMessage = new ConnectedMessage(application, sessionId, key); broadcaster.broadcast(wsMessage, message); }
/** * Synchronizing eraseAll request between whiteboard clients * * @return */ private boolean handleEraseAll() { elementMap.clear(); IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry(); for (IWebSocketConnection c : reg.getConnections(Application.get())) { try { JSONArray jsonArray = new JSONArray(); c.sendMessage(getEraseAllMessage(jsonArray).toString()); return true; } catch (Exception e) { log.error("Unexpected error while sending message through the web socket", e); } } return false; }
/** * Load the components of a particular document from the documents folder and synchronizing the list between * whiteboard clients * * @param docBaseName */ private void handleDocComponents(String docBaseName) { loadDocuments(); IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry(); for (IWebSocketConnection c : reg.getConnections(Application.get())) { try { JSONArray jsonArray = new JSONArray(); for (String url : docMap.get(docBaseName)) { jsonArray.put(url); } c.sendMessage(getDocumentComponentListMessage(jsonArray).toString()); } catch (Exception e) { log.error("Unexpected error while sending message through the web socket", e); } } }
JSONArray changeList = new JSONArray(); IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry(); whiteboardMap.get(whiteboardObjectId).setBackground(previousBackground); IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry(); for (IWebSocketConnection c : reg.getConnections(Application.get())) { try {