%Net.WebSocket.Client
class %Net.WebSocket.Client extends %Library.RegisteredObject [ Final ]
Implements a WebSocket client.Usage:
- Implement %Net.WebSocket.IEventListener to respond to events (most importantly, receipt of a message).
- Implement %Net.WebSocket.ICredentials to provide a username/password/SSLConfiguration for the connection as needed.
- Create a new instance of %Net.WebSocket.Client, providing a WebSocket URL and instances of the ICredentials and IEventListener implementations.
- Call Next()() to wait for the next message, and Send() to send a message.
Property Inventory
Method Inventory
Properties
property URL as %String [ ReadOnly ];
WebSocket endpoint
Property methods: URLDisplayToLogical(), URLGet(), URLIsValid(), URLLogicalToDisplay(), URLLogicalToOdbc(), URLNormalize()
Methods
method %OnNew(pURL As %String, pCredentials As %Net.WebSocket.ICredentials = $$$NULLOREF, pEventListener As %Net.WebSocket.IEventListener = $$$NULLOREF, pAcceptedProtocols As %String = "", pRequest As %Net.HttpRequest = $$$NULLOREF) as %Status
Inherited description: This callback method is invoked by the %New() method to
provide notification that a new instance of an object is being created.
If this method returns an error then the object will not be created.
It is passed the arguments provided in the %New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from %New(). For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:
Method %OnNew(dob as %Date = "", name as %Name = "") as %Status If instead of returning a %Status code this returns an oref and this oref is a subclass of the current class then this oref will be the one returned to the caller of %New method.
Waits for data from the server. Returns 1 if the connection remains open, and 0 if the connection is closed or an error occurs.
The event listener will be notified upon receiving a message, or if the connection is closed or an error occurs.
@Argument pTimeout Timeout (in seconds) to wait to receive a message from the server. @Argument pTimedOut True if the read operation timed out.
The event listener will be notified upon receiving a message, or if the connection is closed or an error occurs.
@Argument pTimeout Timeout (in seconds) to wait to receive a message from the server. @Argument pTimedOut True if the read operation timed out.
Sends a ping frame to the server.
Returns $$$NetWebSocketErrPingTimeout if the ping times out
Returns $$$NetWebSocketErrPongInvalid if the pong response is not equal to pMessage
Otherwise, returns $$$OK @Argument pMessage Message to send with the ping @Argument pFragmentSize Timeout (in seconds) to wait to receive a "pong" back from the server.
Returns $$$NetWebSocketErrPingTimeout if the ping times out
Returns $$$NetWebSocketErrPongInvalid if the pong response is not equal to pMessage
Otherwise, returns $$$OK @Argument pMessage Message to send with the ping @Argument pFragmentSize Timeout (in seconds) to wait to receive a "pong" back from the server.
Sends an unsolicited pong frame to the server.
@Argument pMessage Message to send with the pong
@Argument pMessage Message to send with the pong
Sends a binary or character stream, dynamic object, or string to the server.
@Argument pContent Binary or character stream, dynamic object, or string to the server.
@Argument pFragmentSize Maximum size (in bytes) to send in a single frame; 0 indicates no maximum.
Inherited Members
Inherited Methods
- %AddToSaveSet()
- %ClassIsLatestVersion()
- %ClassName()
- %ConstructClone()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchGetProperty()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %DispatchSetProperty()
- %Extends()
- %GetParameter()
- %IsA()
- %IsModified()
- %New()
- %NormalizeObject()
- %ObjectModified()
- %OriginalNamespace()
- %PackageName()
- %RemoveFromSaveSet()
- %SerializeObject()
- %SetModified()
- %ValidateObject()