UNPKG

diffusion

Version:

Diffusion JavaScript client

103 lines (102 loc) 3.63 kB
"use strict"; /** * @module Session.clients */ Object.defineProperty(exports, "__esModule", { value: true }); exports.SessionState = exports.SessionEventStreamEventType = exports.SessionEventType = void 0; /** * Event types used within {@link SessionPropertiesListener.onSessionEvent}. * * **Example:** * ``` * session.clients.setSessionPropertiesListener(props, { * // ... * * onSessionEvent : function(sessionID, event, properties, previous) { * switch (event) { * case session.clients.SessionEventType.DISCONNECTED : * console.log(sessionID + " has disconnected"); * break; * case session.clients.SessionEventType.RECONNECTED : * console.log(sessionID + " has reconnected"); * break; * } * } * * // ... * }); * ``` * * @deprecated since 6.11 * <p> * This type is required for the deprecated {@link SessionPropertiesListener} * which is used with the deprecated {@link ClientControl.setSessionPropertiesListener}. * <p> * Use the new {@link ClientControl.addSessionEventListener}, * which provides greater functionality and reports sessions at * all cluster members. This interface will be removed in a * future release. */ var SessionEventType; (function (SessionEventType) { /** * One or more relevant session properties have been updated. */ SessionEventType[SessionEventType["UPDATED"] = 0] = "UPDATED"; /** * A session has reconnected. */ SessionEventType[SessionEventType["RECONNECTED"] = 1] = "RECONNECTED"; /** * A session has failed over from one server to another in a cluster. */ SessionEventType[SessionEventType["FAILED_OVER"] = 2] = "FAILED_OVER"; /** * A session has disconnected. */ SessionEventType[SessionEventType["DISCONNECTED"] = 3] = "DISCONNECTED"; })(SessionEventType = exports.SessionEventType || (exports.SessionEventType = {})); /** * The type of a {@link SessionEvent}. */ var SessionEventStreamEventType; (function (SessionEventStreamEventType) { /** * The event indicates a change of state of the identified * session, including the opening of a new session. */ SessionEventStreamEventType[SessionEventStreamEventType["STATE"] = 0] = "STATE"; /** * The event indicates a change to the session properties of the * identified session. */ SessionEventStreamEventType[SessionEventStreamEventType["PROPERTIES"] = 1] = "PROPERTIES"; })(SessionEventStreamEventType = exports.SessionEventStreamEventType || (exports.SessionEventStreamEventType = {})); /** * The session state as given by a {@link SessionEvent}. */ var SessionState; (function (SessionState) { /** * The session is connected and active. */ SessionState[SessionState["ACTIVE"] = 0] = "ACTIVE"; /** * The session is disconnected. */ SessionState[SessionState["DISCONNECTED"] = 1] = "DISCONNECTED"; /** * The session has reconnected to the same server after a * disconnection. */ SessionState[SessionState["RECONNECTED"] = 2] = "RECONNECTED"; /** * The session has failed over to a different server in the * cluster after a disconnection. */ SessionState[SessionState["FAILED_OVER"] = 3] = "FAILED_OVER"; /** * The session has closed. */ SessionState[SessionState["CLOSED"] = 4] = "CLOSED"; })(SessionState = exports.SessionState || (exports.SessionState = {}));