matssocket
Version:
MatsSocket client library
95 lines • 4.16 kB
TypeScript
/**
* Fractional milliseconds for high-res timing.
*/
export type FractionalMillis = number;
/**
* Timestamp, millis-since-epoch.
*/
export type Timestamp = number;
/**
* Message Received on Server event: "acknowledge" or "negative acknowledge" - these are the events which the
* returned Promise of a send(..) is settled with (i.e. then() and catch()), and which
* {@link MatsSocket#request request}'s receivedCallback function are invoked with.
*
* @param {ReceivedEventType} type - {@link ReceivedEvent#type}
* @param {string} traceId - {@link ReceivedEvent#traceId}
* @param {Timestamp} sentTimestamp - {@link ReceivedEvent#sentTimestamp}
* @param {Timestamp} receivedTimestamp - {@link ReceivedEvent#receivedTimestamp}
* @param {Timestamp} roundTripMillis - {@link ReceivedEvent#roundTripMillis}
* @param {string} description - {@link ReceivedEvent#description}
* @class
*/
export function ReceivedEvent(type: ReceivedEventType, traceId: string, sentTimestamp: Timestamp, receivedTimestamp: Timestamp, roundTripMillis: Timestamp, description: string): void;
export class ReceivedEvent {
/**
* Message Received on Server event: "acknowledge" or "negative acknowledge" - these are the events which the
* returned Promise of a send(..) is settled with (i.e. then() and catch()), and which
* {@link MatsSocket#request request}'s receivedCallback function are invoked with.
*
* @param {ReceivedEventType} type - {@link ReceivedEvent#type}
* @param {string} traceId - {@link ReceivedEvent#traceId}
* @param {Timestamp} sentTimestamp - {@link ReceivedEvent#sentTimestamp}
* @param {Timestamp} receivedTimestamp - {@link ReceivedEvent#receivedTimestamp}
* @param {Timestamp} roundTripMillis - {@link ReceivedEvent#roundTripMillis}
* @param {string} description - {@link ReceivedEvent#description}
* @class
*/
constructor(type: ReceivedEventType, traceId: string, sentTimestamp: Timestamp, receivedTimestamp: Timestamp, roundTripMillis: Timestamp, description: string);
/**
* Values are from {@link ReceivedEventType}: Type of received event, either {@link ReceivedEventType#ACK "ack"},
* {@link ReceivedEventType#NACK "nack"} - <b>or {@link ReceivedEventType#SESSION_CLOSED "sessionclosed"} if the
* session was closed with outstanding initiations and MatsSocket therefore "clears out" these initiations.</b>
*s
* @type {ReceivedEventType}
*/
type: ReceivedEventType;
/**
* TraceId for this call / message.
*
* @type {string}
*/
traceId: string;
/**
* Millis-since-epoch when the message was sent from the Client.
*
* @type {Timestamp}
*/
sentTimestamp: Timestamp;
/**
* Millis-since-epoch when the ACK or NACK was received on the Client, millis-since-epoch.
*
* @type {Timestamp}
*/
receivedTimestamp: Timestamp;
/**
* Round-trip time in milliseconds from Initiation of flow (send, request, requestReplyTo) to Received
* acknowledgement (ACK/NACK) was received, basically <code>{@link #receivedTimestamp}
* - {@link #sentTimestamp}</code>, 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 <code>performance.now()</code>.
* <p/>
* Notice that Received-events might be de-prioritized on the Server side (batched up, with micro-delays
* to get multiple into the same batch), so this number should not be taken as the "ping time".
*
* @type {FractionalMillis}
*/
roundTripMillis: FractionalMillis;
/**
* Sometimes, typically on Server NACKs (e.g. targetting non-existing Endpoint), the Server supplies a
* description to why this was no good.
*
* @type {string}
*/
description: string;
}
/**
* *
*/
export type ReceivedEventType = string;
export namespace ReceivedEventType {
let ACK: string;
let NACK: string;
let TIMEOUT: string;
let SESSION_CLOSED: string;
}
//# sourceMappingURL=ReceivedEvent.d.ts.map