%CSP.WebSocket
class %CSP.WebSocket
extends
The %CSP.WebSocket object serves as an event handler for communication between client and server using the WebSocket protocol (RFC 6455). All WebSocket servers derive from %CSP.WebSocket.
Inventory
Summary
Properties | |||
---|---|---|---|
AtEnd | BinaryData | GWClientAddress | NoDataFraming |
SessionId | SharedConnection | WebSocketID |
Subclasses | |
---|---|
%Atelier.v1.XDebugAgent | %Atelier.v2.XDebugAgent |
Parameters
Specifies if we wish to turn off charset conversion for this page. Normally CSP uses the tables built into InterSystems IRIS to convert between different charset's, however if you do not have a charset available you may wish to turn this off to avoid getting the error page saying that this charset is not installed. Then the data will be output and read in using RAW mode. This can be overridden using the <CSP:CONTENT NOCHARSETCONVERT=1> tag, or by setting the %response.NoCharSetConvert property in theOnPreHTTP method.
This parameter controls the CSP session support. By default CSP will use a persistent session which holds a license until the session is ended or times out. If you override this then this CSP page will use a transient session which is never persisted.
Properties
The AtEnd property is set to true (1) when, during a read, the WebSocket server has reached the end of the current data frame.
This property determines whether the data streams transmitted between the client and server should be treated as binary. The default setting is to treat the incoming and outgoing data as UTF-8 encoded text.
This property may be set to one of the following:
- BinaryData=0 - UTF-8 encoded text.
- BinaryData=1 - Binary Data.
The address through which a WebSocket operating asynchronously (SharedConnection=1 ) can communicate with the hosting CSP Gateway.
This property determines whether formal data framing should occur between the Web Gateway and InterSystems IRIS
- NoDataFraming=0 - Use the READ and WRITE methods in this class to manage I/O with the WebSocket.
- NoDataFraming=1 - Use the basic ObjectScript READ and WRITE commands to manage I/O with the WebSocket (SharedConnection cannot be set with this mode).
The CSP Session ID from which this WebSocket was created.
This property determines whether the communication between the client and WebSocket server should be over a dedicated Gateway conection or over a pool of shared connections. It may be set to one of the following:
- SharedConnection=0 - The WebSocket server communicates with the client via a dedicated Gateway connection. In this mode of operation the hosting connection is effectively 'private' to the application session.
- SharedConnection=1 - The WebSocket server communicates asynchronously with the client via a fixed number of shared Gateway connections.
The unique identity of this WebSocket.
Methods
Gracefully terminate the WebSocket Server.
Internal method to initialize the WebSocket Class.
Internal method to initialize the WebSocket Server.
Event handler for the ClientMessage event: this method is only relevant to WebSockets operating in Asynchronous mode. In other words WebSockets for which theSharedConnection flag is set. IfOnClientMessage successfully processes the client message it must return with $$$OK
Event handler for the PostServer event: this is invoked after closing the WebSockets Server.
Event handler for the PreServer event: this is invoked before starting the WebSockets Server. Changes to theSharedConnection flag must be made here.
Method to open an existing WebSocket Server. Only a WebSocket operating asynchronously (SharedConnection=1 ) can be accessed using this method.
Reads up to len characters from the client. If the call is successful the status (sc) will be returned as $$$OK, otherwise an error code of $$$CSPWebSocketTimeout indicates a timeout and $$$CSPWebSocketClosed indicates that the client has terminated the WebSocket.
The WebSocket Server. Use theRead andWrite methods to receive data from, and send data to, the client. Call theEndServer method to gracefully terminate the WebSocket Server. A WebSocket operating asynchronously (SharedConnection=1 ) can exit this method (using Quit) and subsequently open the WebSocket using theOpenServer method.
Write to the client.