Examples of IWebSocketConnectionRegistry


Examples of org.apache.wicket.protocol.ws.api.IWebSocketConnectionRegistry

        ChatMessage m = new ChatMessage();
        m.setMessage(message);
        m.setSent(new Date());
        m.setFromUser(Application.getBean(UsersDao.class).get(WebSession.getUserId()));
        dao.update(m);
        IWebSocketConnectionRegistry reg = IWebSocketSettings.Holder.get(getApplication()).getConnectionRegistry();
        for (IWebSocketConnection c : reg.getConnections(getApplication())) {
          try {
            c.sendMessage(getMessage(m).toString());
          } catch(Exception e) {
            log.error("Error while sending message", e);
          }
View Full Code Here

Examples of org.apache.wicket.protocol.ws.api.registry.IWebSocketConnectionRegistry

    @Override
    public void run()
    {
      Application application = Application.get(applicationName);
      IWebSocketSettings webSocketSettings = IWebSocketSettings.Holder.get(application);
      IWebSocketConnectionRegistry webSocketConnectionRegistry = webSocketSettings.getConnectionRegistry();
      IWebSocketConnection connection = webSocketConnectionRegistry.getConnection(application, sessionId, key);

      int dataIndex = 0;

      while (dataIndex < data.length)
      {
View Full Code Here

Examples of org.apache.wicket.protocol.ws.api.registry.IWebSocketConnectionRegistry

    @Override
    public void run()
    {
      Application application = Application.get(applicationName);
      WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application);
      IWebSocketConnectionRegistry webSocketConnectionRegistry = webSocketSettings.getConnectionRegistry();
      IWebSocketConnection connection = webSocketConnectionRegistry.getConnection(application, sessionId, key);

      int dataIndex = 0;

      while (dataIndex < data.length)
      {
View Full Code Here

Examples of org.apache.wicket.protocol.ws.api.registry.IWebSocketConnectionRegistry

            ChatMessage m = new ChatMessage();
            m.setMessage(unescapeXml(chatMessage.getDefaultModelObjectAsString()));
            m.setSent(new Date());
            m.setFromUser(getBean(UserDao.class).get(getUserId()));
            dao.update(m);
            IWebSocketConnectionRegistry reg = IWebSocketSettings.Holder.get(getApplication()).getConnectionRegistry();
            for (IWebSocketConnection c : reg.getConnections(getApplication())) {
              try {
                c.sendMessage(getMessage(m).toString());
              } catch(Exception e) {
                log.error("Error while sending message", e);
              }
View Full Code Here

Examples of org.apache.wicket.protocol.ws.api.registry.IWebSocketConnectionRegistry

            ChatMessage m = new ChatMessage();
            m.setMessage(unescapeXml(chatMessage.getDefaultModelObjectAsString()));
            m.setSent(new Date());
            m.setFromUser(getBean(UserDao.class).get(getUserId()));
            dao.update(m);
            IWebSocketConnectionRegistry reg = IWebSocketSettings.Holder.get(getApplication()).getConnectionRegistry();
            for (IWebSocketConnection c : reg.getConnections(getApplication())) {
              try {
                c.sendMessage(getMessage(m).toString());
              } catch(Exception e) {
                log.error("Error while sending message", e);
              }
View Full Code Here

Examples of org.apache.wicket.protocol.ws.api.registry.IWebSocketConnectionRegistry

        // Synchronizing newly added/edited element between whiteboard clients
        if (element != null) {
          elementMap.put(element.getId(), element);

          IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry();
          for (IWebSocketConnection c : reg.getConnections(Application.get())) {
            try {
              JSONObject jsonObject = new JSONObject(editedElement);
              c.sendMessage(getAddElementMessage(jsonObject).toString());
            } catch (Exception e) {
              log.error("Unexpected error while sending message through the web socket", e);
View Full Code Here

Examples of org.apache.wicket.protocol.ws.api.registry.IWebSocketConnectionRegistry

      undoSnapshotCreationList_Background.addLast(previousBackground == null);
      undoSnapshots_Background.addLast(previousBackground);
      isElementSnapshotList.addLast(false);

      IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry();
      for (IWebSocketConnection c : reg.getConnections(Application.get())) {
        try {
          JSONObject jsonObject = new JSONObject(backgroundString);
          c.sendMessage(getAddBackgroundMessage(jsonObject).toString());
        } catch (Exception e) {
          log.error("Unexpected error while sending message through the web socket", e);
View Full Code Here

Examples of org.apache.wicket.protocol.ws.api.registry.IWebSocketConnectionRegistry

        List<Element> undoElement = undoSnapshots.pollLast();

        String deleteList = "";
        JSONArray changeList = new JSONArray();

        IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry();

        for (int i = 0; i < undoElement.size(); i++) {
          if (undoCreationList.get(i)) {
            elementMap.remove(undoElement.get(i).getId());
            if (loadedElementMap.containsKey(undoElement.get(i).getId())) {
              loadedContent = "";
              whiteboardMap.get(whiteboardObjectId).setLoadedContent("");
              loadedElementMap.remove(undoElement.get(i).getId());
            }
            if ("".equals(deleteList)) {
              deleteList = "" + undoElement.get(i).getId();
            } else {
              deleteList += "," + undoElement.get(i).getId();
            }
          } else {
            elementMap.put(undoElement.get(i).getId(), undoElement.get(i));
            try {
              changeList.put(undoElement.get(i).getJSON());
            } catch (JSONException e) {
              log.error("Unexpected error while getting JSON", e);
            }
          }
        }

        for (IWebSocketConnection c : reg.getConnections(Application.get())) {
          try {
            c.sendMessage(getUndoMessage(changeList, deleteList).toString());
          } catch (Exception e) {
            log.error("Unexpected error while sending message through the web socket", e);
          }
        }
      } else {
        Background previousBackground = undoSnapshots_Background.pollLast();
        background = previousBackground;
        whiteboardMap.get(whiteboardObjectId).setBackground(previousBackground);

        IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry();
        for (IWebSocketConnection c : reg.getConnections(Application.get())) {
          try {
            if (previousBackground != null) {
              c.sendMessage(getAddBackgroundMessage(previousBackground.getJSON()).toString());
            } else {
              c.sendMessage(getAddBackgroundMessage(new JSONObject()).toString());
View Full Code Here

Examples of org.apache.wicket.protocol.ws.api.registry.IWebSocketConnectionRegistry

   *
   * @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) {
View Full Code Here

Examples of org.apache.wicket.protocol.ws.api.registry.IWebSocketConnectionRegistry

  /**
   * 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);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.