elementMap.put(element.getId(), element); IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry(); for (IWebSocketConnection c : reg.getConnections(Application.get())) { try {
WebSocketSettings.Holder.set(this, new WebSocketSettings() {
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 {
WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(component.getApplication());
this.webSocketSettings = WebSocketSettings.Holder.get(application);
WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(component.getApplication());
isElementSnapshotList.addLast(false); IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry(); for (IWebSocketConnection c : reg.getConnections(Application.get())) { try {
WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application); webSocketSettings.getSendPayloadExecutor().run(action);
this.webSocketSettings = WebSocketSettings.Holder.get(application);
WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application); webSocketSettings.getSendPayloadExecutor().run(action);
this.webSocketSettings = WebSocketSettings.Holder.get(application);
/** * 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); } } }
/** * 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; }
/** * 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); } } }
private void process(final Application application, final Collection<IWebSocketConnection> wsConnections, final IWebSocketPushMessage message) { WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application); Executor executor = webSocketSettings.getWebSocketPushMessageExecutor(); for (final IWebSocketConnection wsConnection : wsConnections) { executor.run(new Runnable() { @Override public void run() { wsConnection.sendMessage(message); } }); } } }
/** * Load the clipArts list from the clipArt folder and synchronizing the list between whiteboard clients */ private void handleClipArts() { loadClipArts(); IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry(); for (IWebSocketConnection c : reg.getConnections(Application.get())) { try { JSONArray jsonArray = new JSONArray(); for (String clipArtURL : clipArts) { jsonArray.put(clipArtURL); } c.sendMessage(getClipArtListMessage(jsonArray).toString()); } catch (Exception e) { log.error("Unexpected error while sending message through the web socket", e); } } }
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; }
private void process(final Application application, final Collection<IWebSocketConnection> wsConnections, final IWebSocketPushMessage message) { WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application); Executor executor = webSocketSettings.getWebSocketPushMessageExecutor(); for (final IWebSocketConnection wsConnection : wsConnections) { executor.run(new Runnable() { @Override public void run() { wsConnection.sendMessage(message); } }); } } }
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; }