IRISLIB database
WebSocket Class Reference

The <CLASS>CSP.WebSocket</CLASS> object serves as an event handler for communication between client and server using the WebSocket protocol (RFC 6455). More...

Inheritance diagram for WebSocket:
Collaboration diagram for WebSocket:

Public Member Functions

_.Library.Status EndServer ()
 Gracefully terminate the WebSocket Server.
 
_.Library.Status Initialize (_.Library.String WebSocketID, _.Library.String GWClientAddress)
 Internal method to initialize the WebSocket Class.
 
_.Library.Status InitializeServer ()
 Internal method to initialize the WebSocket Server.
 
_.Library.Status OnClientMessage (_.Library.String data, _.Library.Integer close)
 Event handler for the ClientMessage event: this method is only relevant to. More...
 
_.Library.Status OnPostServer ()
 Event handler for the PostServer event: this is invoked after. More...
 
_.Library.Status OnPreServer ()
 Event handler for the PreServer event: this is invoked before. More...
 
_.Library.Status OpenServer (_.Library.String WebSocketID)
 Method to open an existing WebSocket Server. More...
 
_.Library.String Read (_.Library.Integer len, _.Library.Status sc, _.Library.Integer timeout)
 Reads up to len characters from the client. More...
 
_.Library.Status Server ()
 The WebSocket Server. More...
 
_.Library.Status Write (_.Library.String data)
 Write to the client.
 
- Public Member Functions inherited from RegisteredObject
_.Library.Status OnAddToSaveSet (_.Library.Integer depth, _.Library.Integer insert, _.Library.Integer callcount)
 This callback method is invoked when the current object is added to the SaveSet,. More...
 
_.Library.Status OnClose ()
 This callback method is invoked by the <METHOD>Close</METHOD> method to. More...
 
_.Library.Status OnConstructClone (_.Library.RegisteredObject object, _.Library.Boolean deep, _.Library.String cloned)
 This callback method is invoked by the <METHOD>ConstructClone</METHOD> method to. More...
 
_.Library.Status OnNew ()
 This callback method is invoked by the <METHOD>New</METHOD> method to. More...
 
_.Library.Status OnValidateObject ()
 This callback method is invoked by the <METHOD>ValidateObject</METHOD> method to. More...
 

Public Attributes

 AtEnd
 The AtEnd property is set to true (1) when, during a read,. More...
 
 BinaryData
 This property determines whether the data streams transmitted between the client and server should be treated as binary. More...
 
 GWClientAddress
 The address through which a WebSocket operating asynchronously (<property>SharedConnection=1</property>) can communicate with the hosting CSP Gateway. More...
 
 NoDataFraming
 This property determines whether formal data framing should occur between the Web Gateway and InterSystems IRIS. More...
 
 SessionEndOnClose
 This property determines whether WebSocket closure forces the associated CSP session to end. More...
 
 SessionId
 The CSP Session ID from which this WebSocket was created. More...
 
 SharedConnection
 This property determines whether the communication between the client and WebSocket server should be over a dedicated Gateway. More...
 
 WebSocketID
 The unique identity of this WebSocket. More...
 

Static Public Attributes

 NOCHARSETCONVERT = None
 The <CLASS>CSP.WebSocket</CLASS> object serves as an event handler for communication between client and server using the WebSocket protocol (RFC 6455). More...
 
- Static Public Attributes inherited from RegisteredObject
 CAPTION = None
 Optional name used by the Form Wizard for a class when generating forms. More...
 
 JAVATYPE = None
 The Java type to be used when exported.
 
 PROPERTYVALIDATION = None
 This parameter controls the default validation behavior for the object. More...
 
- Static Public Attributes inherited from Page
 CHARSET = None
 The <CLASS>CSP.Page</CLASS> object serves as an event handler for CSP requests. More...
 
 CONTENTTYPE = None
 Specifies the default content type for the page. More...
 
 CONVERTINPUTSTREAM = None
 Specifies if input request.Content or request.MimeData values are converted from their. More...
 
 CSPFILE = None
 If this page was compiled from a .csp file, then this parameter contains the. More...
 
 CSPSTRICT = None
 The CSPSTRICT parameter is set to 1, if the DOCTYPE indicates that this. More...
 
 CSPURL = None
 This parameter is used to make sure that if multiple. More...
 
 CSPXHTML = None
 The CSPXHTML parameter is set to 1, if the DOCTYPE indicates that this. More...
 
 DOMAIN = None
 The default domain for csp:text, span and div tags. More...
 
 ENCODED = None
 Controls how the query parameters for this page are passed, it can. More...
 
 ERRORPAGE = None
 Specify a custom error page to call if there are any problems with generating this page. More...
 
 EXPIRES = None
 Specified the default value for the response.Expires. More...
 
 NOCHARSETCONVERT = None
 Specifies if we wish to turn off charset conversion for this page. More...
 
 PAGETIMING = None
 If this parameter is true then we automatically record timing statistics of how long it takes to. More...
 
 PRIVATE = None
 Controls the access to the page, it can be set to one of the following:
More...
 
 SECURITYRESOURCE = None
 This is a comma-delimited list of system Resources and associated. More...
 
 TIMINGSLOTS = None
 Used by the timing to decide how many slots a day should be divided up into. More...
 
 UseSession = None
 This parameter controls the CSP session support. More...
 

Private Member Functions

_.Library.Status __DeleteServer ()
 Internal method to delete the WebSocket Server.
 
_.Library.Status __SaveServer ()
 Internal method to save the WebSocket Server.
 

Private Attributes

 __BytesAvailable
 The amount of client data waiting to be read. More...
 
 __DataFrameType
 The type of the Data Frame waiting to be read. More...
 
 __WSClassProtocolVersion
 The version of the transmission protocol between the CSP Gateway and this class. More...
 
 __WSDataFraming
 The flag indicating that WebSocket data framing should be used for write operations. More...
 
 __WSInitStatus
 The internal initialization status for the WebSocket. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Page
_.Library.Status ConvertParameter (_.Library.String url, _.Library.String name, _.Library.String value)
 You pass this the <parameter>url</parameter> of the page you are going to and a. More...
 
_.Library.Binary Decrypt (_.Library.String data)
 Decrypts the input string using the session.Key value that is unique to. More...
 
_.Library.String Encrypt (_.Library.Binary data)
 Encrypts the input string using the session.Key value that is unique to this. More...
 
_.Library.String EscapeHTML (in)
 This method converts input HTML text into Escaped HTML text.
 
_.Library.String EscapeURL (_.Library.String in, _.Library.String charset)
 This method converts the in input URL string into Escaped URL string. More...
 
_.Library.String HyperEventCall (_.Library.String methodName, _.Library.String args, _.Library.Integer type, _.Library.Boolean mobile)
 This method returns the string that needs to be written to the current. More...
 
_.Library.String HyperEventHead (_.Library.Boolean iframeOnly, _.Library.Boolean strict, _.Library.Boolean optionalBroker)
 This method returns the string that needs to be written to the current. More...
 
 Include (_.Library.String url)
 Include another csp page or file in the output at this point. More...
 
_.Library.String InsertHiddenField (_.Library.String url, _.Library.String name, _.Library.String value, _.Library.String extra)
 Inserts a '<input type="hidden" name="Name" value="Value">' tag into the current document. More...
 
_.Library.String InsertHiddenFields (_.Library.String url, _.Library.String query)
 Return the string containing the hidden form tags. More...
 
_.Library.Boolean IsPrivate ()
 Returns 1 if this page is in fact a private page (see <parameter>PRIVATE</parameter>).
 
_.Library.String Link (_.Library.String link, _.Library.String query, _.Library.Boolean addQ)
 Tranforms the link specified by link into a URL and returns it as a string. More...
 
_.Library.Status OnHTTPHeader (_.Library.Boolean OutputBody)
 Event handler for PAGE event: this is invoked in order to
More...
 
_.Library.Status OnPage ()
 Event handler for PAGE event: this is invoked in order to
More...
 
 OnPageError (_.Library.Status sc)
 Event handler for any error that occurs on the page. More...
 
 OnPostHTTP ()
 Event handler for POSTPAGE event: this is invoked after the data. More...
 
_.Library.Status OnPostHyperEvent (_.Library.String class, _.Library.String method)
 Event handler which is invoked after a hyperevent method is called on this page.
 
_.Library.Boolean OnPreHTTP ()
 Event handler for PreHTTP event: this is invoked before. More...
 
_.Library.Status OnPreHyperEvent (_.Library.String class, _.Library.String method)
 Event handler which is invoked before a hyperevent method is called on this page. More...
 
_.Library.Status Page (_.Library.Boolean skipheader)
 Process a request to serve a CSPPage. More...
 
_.Library.String QuoteJS (in)
 This method converts input string into quoted JavaScript literal.
 
_.Library.String RewriteURL (_.Library.String url)
 This method will rewrite a URL to use #url()# if needed.
 
 ShowError (_.Library.Status sc)
 Display a <class>Status</class> error code to the CSP Page.
 
 StartTimer (_.Library.String name)
 Used to get performance information on your CSP pages. More...
 
 StopTimer (_.Library.String name)
 Used to time performance information on your CSP pages. More...
 
 ThrowError (_.Library.Status sc)
 Passed a <class>Status</class> code this goes to the error page passing this status code.
 
_.Library.String UnescapeHTML (in)
 This method converts Escaped HTML text into normal HTML text.
 
_.Library.String UnescapeURL (_.Library.String in, _.Library.String charset)
 This method converts the in Escaped URL string back to its original form. More...
 

Detailed Description

The <CLASS>CSP.WebSocket</CLASS> 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.

Member Function Documentation

◆ OnClientMessage()

_.Library.Status OnClientMessage ( _.Library.String  data,
_.Library.Integer  close 
)

Event handler for the ClientMessage event: this method is only relevant to.

WebSockets operating in Asynchronous mode. In other words WebSockets for which the <property>SharedConnection</property> flag is set. If <method>OnClientMessage</method> successfully processes the client message it must return with 1.

◆ OnPostServer()

_.Library.Status OnPostServer ( )

Event handler for the PostServer event: this is invoked after.

closing the WebSockets Server.

Reimplemented in TerminalAgent.

◆ OnPreServer()

_.Library.Status OnPreServer ( )

Event handler for the PreServer event: this is invoked before.

starting the WebSockets Server. Changes to the <property>SharedConnection</property> flag must be made here.

Reimplemented in TerminalAgent, XDebugAgent, XDebugAgent, and XDebugAgent.

◆ OpenServer()

_.Library.Status OpenServer ( _.Library.String  WebSocketID)

Method to open an existing WebSocket Server.

Only a WebSocket operating asynchronously (<property>SharedConnection=1</property>) can be accessed using this method.

◆ Read()

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.

◆ Server()

_.Library.Status Server ( )

The WebSocket Server.

Use the <Method>Read</Method> and <Method>Write</Method> methods

to receive data from, and send data to, the client. Call the <Method>EndServer</Method> method to gracefully terminate the WebSocket Server. A WebSocket operating asynchronously (<property>SharedConnection=1</property>) can exit this method (using Quit) and subsequently open the WebSocket using the <Method>OpenServer</Method> method.

Reimplemented in TerminalAgent, XDebugAgent, XDebugAgent, and XDebugAgent.

Member Data Documentation

◆ NOCHARSETCONVERT

NOCHARSETCONVERT = None
static

The <CLASS>CSP.WebSocket</CLASS> 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.

◆ AtEnd

AtEnd

The AtEnd property is set to true (1) when, during a read,.

the WebSocket server has reached the end of the current data frame.  

◆ BinaryData

BinaryData

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.

 

◆ __BytesAvailable

__BytesAvailable
private

The amount of client data waiting to be read.

 

◆ __DataFrameType

__DataFrameType
private

The type of the Data Frame waiting to be read.

 

◆ GWClientAddress

GWClientAddress

The address through which a WebSocket operating asynchronously (<property>SharedConnection=1</property>) can communicate with the hosting CSP Gateway.

 

◆ NoDataFraming

NoDataFraming

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).

 

◆ SessionEndOnClose

SessionEndOnClose

This property determines whether WebSocket closure forces the associated CSP session to end.

Must be set in either Server() or OnPostServer(). For WebSockets operating asynchronously, only takes effect if EndServer() is called in Server().

This property may be set to one of the following:

  • SessionEndOnClose=0 - Do not force the CSP session to end when the web socket closes. (For synchronous web sockets, the CSP session may still end depending on its EndSession property.)
  • SessionEndOnClose=1 - Ensure that the CSP session ends when the web socket closes.

 

◆ SessionId

SessionId

The CSP Session ID from which this WebSocket was created.

 

◆ SharedConnection

SharedConnection

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.

 

◆ __WSClassProtocolVersion

__WSClassProtocolVersion
private

The version of the transmission protocol between the CSP Gateway and this class.

 

◆ __WSDataFraming

__WSDataFraming
private

The flag indicating that WebSocket data framing should be used for write operations.

 

◆ __WSInitStatus

__WSInitStatus
private

The internal initialization status for the WebSocket.

 

◆ WebSocketID

WebSocketID

The unique identity of this WebSocket.