Class WebSocketChannel
- java.lang.Object
-
- com.inductiveautomation.perspective.gateway.comm.WebSocketChannel
-
- All Implemented Interfaces:
MessageChannel
@WebSocket public class WebSocketChannel extends java.lang.Object implements MessageChannel
AWebSocketChannel
connection that is mounted for realtime messaging between a running web-client and the Ignition gateway's Perspective module.- Since:
- 8.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WebSocketChannel.CloseEventDefinitions
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the message channelboolean
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)
-
-
-
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 interfaceMessageChannel
-
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 interfaceMessageChannel
-
isOpen
public boolean isOpen()
- Specified by:
isOpen
in interfaceMessageChannel
- Returns:
- false if the message channel not connected
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceMessageChannel
- 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 interfaceMessageChannel
- Throws:
java.io.IOException
-
close
public void close()
Description copied from interface:MessageChannel
Close the message channel- Specified by:
close
in interfaceMessageChannel
-
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 classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.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()
-
-