Class WebSocketChannel

  • All Implemented Interfaces:
    MessageChannel

    @WebSocket
    public class WebSocketChannel
    extends java.lang.Object
    implements MessageChannel
    A WebSocketChannel connection that is mounted for realtime messaging between a running web-client and the Ignition gateway's Perspective module.
    Since:
    8.0.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close the message channel
      boolean equals​(java.lang.Object o)  
      java.lang.String getAllCloseEventDefinitionsAsJson()  
      java.util.Map<java.lang.String,​java.lang.String> getCloseEventDefinitions​(int code)  
      java.lang.String getPageId()
      Returns the view group identifier, which is used to differentiate between different instances of the same project .
      java.lang.String getProject()
      Returns the name of the project, which is unique.
      void handleSocketInit()  
      int hashCode()  
      boolean isClosed()  
      boolean isOpen()  
      void onClose​(int statusCode, java.lang.String reason)  
      void onConnect​(org.eclipse.jetty.websocket.api.Session socket)  
      void onError​(java.lang.Throwable error)  
      void onMessage​(org.eclipse.jetty.websocket.api.Session client, java.lang.String rawMessage)  
      void send​(java.lang.String protocol, java.lang.String payload)
      Sends a message to be handled by the appropriate handler (as identified by the protocol)
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getProject

        public java.lang.String getProject()
        Description copied from interface: MessageChannel
        Returns the name of the project, which is unique.
        Specified by:
        getProject in interface MessageChannel
      • getPageId

        public java.lang.String getPageId()
        Description copied from interface: MessageChannel
        Returns the view group identifier, which is used to differentiate between different instances of the same project . For a live project running in a browser, this might be the unique browser tab identifier. For a designer, this may be a specific workspace tab.
        Specified by:
        getPageId in interface MessageChannel
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface MessageChannel
        Returns:
        false if the message channel not connected
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in interface MessageChannel
        Returns:
        true iff this channel was closed by the local side of this connection (in order words: from a call to MessageChannel.close()
      • send

        public void send​(java.lang.String protocol,
                         java.lang.String payload)
                  throws java.io.IOException
        Description copied from interface: MessageChannel
        Sends a message to be handled by the appropriate handler (as identified by the protocol)
        Specified by:
        send in interface MessageChannel
        Throws:
        java.io.IOException
      • onConnect

        @OnWebSocketConnect
        public void onConnect​(org.eclipse.jetty.websocket.api.Session socket)
      • onMessage

        @OnWebSocketMessage
        public void onMessage​(org.eclipse.jetty.websocket.api.Session client,
                              java.lang.String rawMessage)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • onClose

        @OnWebSocketClose
        public void onClose​(int statusCode,
                            java.lang.String reason)
      • onError

        @OnWebSocketError
        public void onError​(java.lang.Throwable error)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • handleSocketInit

        public void handleSocketInit()
      • getCloseEventDefinitions

        public java.util.Map<java.lang.String,​java.lang.String> getCloseEventDefinitions​(int code)
      • getAllCloseEventDefinitionsAsJson

        public java.lang.String getAllCloseEventDefinitionsAsJson()