Ankündigung

Einklappen
Keine Ankündigung bisher.

WebSocket Issues with Unsubcribe

Einklappen
X

WebSocket Issues with Unsubcribe

Einklappen
  • Filter
  • Zeit
Alles löschen
neue Beiträge

  • WebSocket Issues with Unsubcribe

    Hi,
    I'm having some issues with the WebSockets, I'm able to make it work everything works perfect but once I finished using it and I want to unsubscribe the js code "onmessage: " is being executed in the other pages alltough I already unsubscribe.
    In the Unsubscribe method I tried several ways to unsubscribe but is always the same the onmessage function is being executed in other pages.

    Name of the topic: TestWebSocket

    Js Code
    /* JavaScript for all devices */

    Code:
    function subscribeWebsocketMessage() {
    
                  console.log("Inicio subscribe");
    
      ix.websocket.subscribeToTopic("8BBF777DBABF61F4DF3 6DF5479A8626B552EFBBC", {
    
        key: "openDocuments",
    
        onmessage: function onmessage(data) {
    
                  console.log("atroden");
    
                  console.log("data: " + data);
    
                  Notifier.status.error(data, data, "KEY", {closeByButton: true});
    
          var elementToDisplayMessage = getElement("45A86A7E612B916F6DABFE677D009046C6C84F 12");
    
          elementToDisplayMessage.innerHTML =
    
            elementToDisplayMessage.innerHTML + data + " ";
    
        }
    
      });
    
    }
    
    
    
    function unSubscribeWebsocketMessage() {
    
    console.log("Inicio unSubscribe");
    
    ix.websocket.unsubscribeFromTopic("openDocuments", "TestWebSocket");
    
    ix.websocket.unsubscribeFromTopic("8BBF777DBABF61F 4DF36DF5479A8626B552EFBBC", "TestWebSocket");
    
    ix.websocket.unsubscribeFromTopic("openDocuments" ["TestWebSocket"]);
    
    ix.websocket.unsubscribeFromTopic("8BBF777DBABF61F 4DF36DF5479A8626B552EFBBC" ["TestWebSocket"]);
    
    }

    and this is how I call the js functions


Lädt...
X