Clients - http : WebSocketCaller

Represents a WebSocket caller.

Remote Methods

Fields

  • negotiatedSubProtocol string
  • The subprotocols that are negotiated with the client

  • isSecure boolean false
  • true if the connection is secure

  • isOpen boolean false
  • true if the connection is open

  • attributes map {}
  • A map to store connection related attributes

pushText

(string | json | xml | boolean | int | float | byte | byte[] data, boolean finalFrame)

returns error?

Push text to the connection.

Parameters

  • finalFrame boolean - true
  • Set to true if this is a final frame of a (long) message

  • Return Type

    (error?)
  • error if an error occurs when sending

pushBinary

(byte[] data, boolean finalFrame)

returns error?

Push binary data to the connection.

Parameters

  • data byte[]
  • Binary data to be sent

  • finalFrame boolean - true
  • Set to true if this is a final frame of a (long) message

  • Return Type

    (error?)
  • error if an error occurs when sending

ping

(byte[] data)

returns error?

Ping the connection.

Parameters

  • data byte[]
  • Binary data to be sent.

  • Return Type

    (error?)
  • error if an error occurs when sending

pong

(byte[] data)

returns error?

Send pong message to the connection.

Parameters

  • data byte[]
  • Binary data to be sent

  • Return Type

    (error?)
  • error if an error occurs when sending

close

(int? statusCode, string? reason, int timeoutInSecs)

returns error?

Close the connection.

Parameters

  • statusCode int? - 1000
  • Status code for closing the connection

  • reason string? - ()
  • Reason for closing the connection

  • timeoutInSecs int - 60
  • Time to wait for the close frame to be received from the remote endpoint before closing the connection. If the timeout exceeds, then the connection is terminated even though a close frame is not received from the remote endpoint. If the value < 0 (e.g., -1), then the connection waits until a close frame is received. If WebSocket frame is received from the remote endpoint, within waiting period the connection is terminated immediately.

  • Return Type

    (error?)
  • error if an error occurs when sending