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
AWebSocketChannelconnection 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 classWebSocketChannel.CloseEventDefinitions
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the message channelbooleanequals(java.lang.Object o)java.lang.StringgetAllCloseEventDefinitionsAsJson()java.util.Map<java.lang.String,java.lang.String>getCloseEventDefinitions(int code)java.lang.StringgetPageId()Returns the view group identifier, which is used to differentiate between different instances of the same project .java.lang.StringgetProject()Returns the name of the project, which is unique.voidhandleSocketInit()inthashCode()booleanisClosed()booleanisOpen()voidonClose(int statusCode, java.lang.String reason)voidonConnect(org.eclipse.jetty.websocket.api.Session socket)voidonError(java.lang.Throwable error)voidonMessage(org.eclipse.jetty.websocket.api.Session client, java.lang.String rawMessage)voidsend(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:MessageChannelReturns the name of the project, which is unique.- Specified by:
getProjectin interfaceMessageChannel
-
getPageId
public java.lang.String getPageId()
Description copied from interface:MessageChannelReturns 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:
getPageIdin interfaceMessageChannel
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfaceMessageChannel- Returns:
- false if the message channel not connected
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin 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.IOExceptionDescription copied from interface:MessageChannelSends a message to be handled by the appropriate handler (as identified by the protocol)- Specified by:
sendin interfaceMessageChannel- Throws:
java.io.IOException
-
close
public void close()
Description copied from interface:MessageChannelClose the message channel- Specified by:
closein 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein 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()
-
-