Class: GDSocketResponse

GDSocketResponse(json, payloadMessageType) → {GDSocketResponse}

This class encapsulates the response returned from the GDSocket class.

Constructor

new GDSocketResponse(json, payloadMessageType) → {GDSocketResponse}

Parameters:
Name Type Description
json string The input data (formatted as JSON text) used to construct the response object.
payloadMessageType string Optional parameter that represents the type of payload message of responseData property in "message" event. Possible values are "string" and "binary". "string" value is by default.
Properties:
Name Type Description
socketID string The unique ID for the socket connection that generated this response.
responseType string This value is used to distinguish what action triggered this response. Valid values are:
  • open - The socket was just successfully opened.
  • message - A new message was received from the server. The responseData property will be populated with the data from the server as String or Uint8Array depending on payloadMessageType. If socket is not closed connections is kept alive waiting for new data coming.
  • error - A socket error occurred. The responseData may or may not be populated with a description of the error.
  • close - The socket connection was closed.
responseData string This field will be populated with data from the server if the response contained data what was intended to be processed by the client.
Source:
Returns:
Type
GDSocketResponse
Example
// This object is used by GDSocket.parseSocketResponse() method and is not used directly