Class: MessageEvent

MessageEvent()

new MessageEvent()

Message Event - the event emitted for a Requests's Promise resolve() and reject() (i.e. then() and catch()), and to a Terminator's resolveCallback and rejectCallback functions for replies due to requestReplyTo, and for Server initiated Sends (to Terminators), and for the event to a Endpoint upon a Server initiated Request, and for the event sent to a Subscription.
Source:

Members

clientRequestTimestamp :number

millis-since-epoch when the Request, for which this message is a Reply, was sent from the Client. If this message is not a Reply to a Client-initiated Request, it is undefined.
Type:
  • number
Source:

correlationInformation :object

When a Terminator gets invoked to handle a Reply due to a Client initiated MatsSocket#requestReplyTo, this holds the 'correlationInformation' object that was supplied in the requestReplyTo(..) invocation.
Type:
  • object
Source:

data :object

The actual data from the other peer.

Notice: In the face of "sessionclosed" or "timeout", this value will be undefined. Wrt. "sessionclosed", this is by definition: The Request was outstanding, meaning that an answer from the Server had yet to come. This is opposed to a normal REJECT settling from the Server-side MatsSocketEndpoint, which may choose to include data with a rejection. The same basically goes wrt. "timeout", as the Server has not replied yet.

Type:
  • object
Source:

debug

If debugging is requested, by means of MatsSocket#debug or the config object in the send, request and requestReplyTo, this will contain a DebugInformation instance. However, the contents of that object is decided by what you request, and what the authorized user is allowed to get as decided by the AuthenticationPlugin when authenticating the user.
Source:

messageId :string

Either the ClientMessageId if this message is a Reply to a Client-initiated Request (i.e. this message is a RESOLVE or REJECT), or ServerMessageId if this originated from the Server (i.e. SEND or REQUEST);
Type:
  • string
Source:

receivedTimestamp :number

When the message was received on the Client, millis-since-epoch.
Type:
  • number
Source:

roundTripMillis :number

For MatsSocket#request() and MatsSocket#requestReplyTo() Requests: Round-trip time in milliseconds from Request was performed to Reply was received, basically #receivedTimestamp - #clientRequestTimestamp, but depending on the browser/runtime, you might get higher resolution than integer milliseconds (i.e. fractions of milliseconds, a floating point number) - it depends on the resolution of performance.now(). Note that this number can be a float, not necessarily integer.
Type:
  • number
Source:

traceId :string

The TraceId for this call / message.
Type:
  • string
Source:

type :string

Values are from MessageEventType: Either "send" (for a Client Terminator when targeted for a Server initiated Send); "request" (for a Client Endpoint when targeted for a Server initiated Request); or "resolve" or "reject" (for settling of Promise from a Client-initiated Request, and for a Client Terminator when targeted as the reply-endpoint for a Client initiated Request) - or "sessionclosed" if the session was closed with outstanding Requests and MatsSocket therefore "clears out" these Requests.

Notice: In the face of "sessionclosed" or "timeout", the #data property (i.e. the actual message from the server) will be undefined. Wrt. "sessionclosed", this is by definition: The Request was outstanding, meaning that an answer from the Server had yet to come. This is opposed to a normal REJECT settling from the Server-side MatsSocketEndpoint, which may choose to include data with a rejection. The same basically goes wrt. "timeout", as the Server has not replied yet.

Type:
  • string
Source: