Class WebSocketChannel

java.lang.Object
com.inductiveautomation.perspective.gateway.comm.WebSocketChannel
All Implemented Interfaces:
MessageChannel

@WebSocket public class WebSocketChannel extends 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 Details

    • getProject

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

      public 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(String protocol, String payload) throws 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:
      IOException
    • close

      public void close()
      Description copied from interface: MessageChannel
      Close the message channel
      Specified by:
      close in interface MessageChannel
    • onConnect

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

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

      @OnWebSocketClose public void onClose(int statusCode, String reason)
    • onError

      @OnWebSocketError public void onError(Throwable error)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public void handleSocketInit()
    • getCloseEventDefinitions

      public Map<String,String> getCloseEventDefinitions(int code)
    • getAllCloseEventDefinitionsAsJson

      public String getAllCloseEventDefinitionsAsJson()