DocumentDeltaConnection Class
Represents a connection to a stream of delta updates
Signature
export declare class DocumentDeltaConnection extends EventEmitterWithErrorHandling<IDocumentDeltaConnectionEvents> implements IDocumentDeltaConnection, IDisposable
Extends: EventEmitterWithErrorHandling<IDocumentDeltaConnectionEvents
Implements: IDocumentDeltaConnection, IDisposable
Constructors
Constructor | Description |
---|---|
(constructor)(socket, documentId, logger, enableLongPollingDowngrades) | Constructs a new instance of the DocumentDeltaConnection class |
Static Properties
Property | Type | Description |
---|---|---|
eventsAlwaysForwarded | string[] | |
eventsToForward | string[] |
Properties
Property | Alerts | Type | Description |
---|---|---|---|
_disposed | boolean | Flag to indicate whether the DocumentDeltaConnection is expected to still be capable of sending messages. After disconnection, we flip this to prevent any stale messages from being emitted. | |
checkpointSequenceNumber | number | undefined | Last known sequence number to ordering service at the time of connection It may lap actual last sequence number (quite a bit, if container is very active). But it's best information for client to figure out how far it is behind, at least for "read" connections. "write" connections may use own "join" op to similar information, that is likely to be more up-to-date. | |
claims | ITokenClaims | Get the claims of the client who is sending the message | |
clientId | string | Get the ID of the client who is sending the message | |
details | IConnected | ||
disposed | boolean | ||
documentId | string | ||
earlyOpHandler | (documentId: string, msgs: ISequencedDocumentMessage[]) => void | ||
earlySignalHandler | (msg: ISignalMessage) => void | ||
existing | boolean | Get whether or not this is an existing document | |
hasDetails | boolean | ||
initialClients | ISignalClient[] | Get initial client list | |
initialMessages | ISequencedDocumentMessage[] | Get messages sent during the connection | |
initialSignals | ISignalMessage[] | Get signals sent during the connection | |
logger | Deprecated |
ITelemetryLogger | |
maxMessageSize | number | Get the maximum size of a message before chunking is required | |
mode | ConnectionMode | Get the mode of the client | |
queuedMessages | ISequencedDocumentMessage[] | ||
queuedSignals | ISignalMessage[] | ||
serviceConfiguration | IClientConfiguration | Configuration details provided by the service | |
socket | Socket | ||
version | string | Semver of protocol being used with the service |
Methods
Method | Return Type | Description |
---|---|---|
addTrackedListener(event, listener) | void | |
createErrorObject(handler, error, canRetry) | IAnyDriverError | Error raising for socket.io issues |
disconnect(socketProtocolError, reason) | void | Disconnect from the websocket. |
dispose() | void | Disconnect from the websocket, and permanently disable this DocumentDeltaConnection. |
disposeCore(socketProtocolError, err) | void | |
emitMessages(type, messages) | void | |
initialize(connectMessage, timeout) | Promise<void> | |
submit(messages) | void | Submits a new delta operation to the server |
submitCore(type, messages) | void | |
submitSignal(message) | void | Submits a new signal to the server |
Constructor Details
(constructor)
Constructs a new instance of the DocumentDeltaConnection
class
Signature
protected constructor(socket: Socket, documentId: string, logger: ITelemetryLogger, enableLongPollingDowngrades?: boolean);
Parameters
Parameter | Modifiers | Type | Description |
---|---|---|---|
socket | Socket | websocket to be used | |
documentId | string | ID of the document | |
logger | ITelemetryLogger | for reporting telemetry events | |
enableLongPollingDowngrades | optional | boolean | allow connection to be downgraded to long-polling on websocket failure |
Property Details
_disposed
Flag to indicate whether the DocumentDeltaConnection is expected to still be capable of sending messages. After disconnection, we flip this to prevent any stale messages from being emitted.
Signature
protected _disposed: boolean;
Type: boolean
checkpointSequenceNumber
Last known sequence number to ordering service at the time of connection It may lap actual last sequence number (quite a bit, if container is very active). But it's best information for client to figure out how far it is behind, at least for "read" connections. "write" connections may use own "join" op to similar information, that is likely to be more up-to-date.
Signature
checkpointSequenceNumber: number | undefined;
Type: number | undefined
claims
Get the claims of the client who is sending the message
Signature
get claims(): ITokenClaims;
Type: ITokenClaims
clientId
Get the ID of the client who is sending the message
Signature
get clientId(): string;
Type: string
details
Signature
get details(): IConnected;
Type: IConnected
disposed
Signature
get disposed(): boolean;
Type: boolean
documentId
Signature
documentId: string;
Type: string
earlyOpHandler
Signature
protected earlyOpHandler: (documentId: string, msgs: ISequencedDocumentMessage[]) => void;
Type: (documentId: string, msgs: ISequencedDocumentMessage[]) => void
earlySignalHandler
Signature
protected earlySignalHandler: (msg: ISignalMessage) => void;
Type: (msg: ISignalMessage) => void
eventsAlwaysForwarded
Signature
static readonly eventsAlwaysForwarded: string[];
Type: string[]
eventsToForward
Signature
static readonly eventsToForward: string[];
Type: string[]
existing
Get whether or not this is an existing document
Signature
get existing(): boolean;
Type: boolean
hasDetails
Signature
protected get hasDetails(): boolean;
Type: boolean
initialClients
Get initial client list
Signature
get initialClients(): ISignalClient[];
Type: ISignalClient[]
initialMessages
Get messages sent during the connection
Signature
get initialMessages(): ISequencedDocumentMessage[];
Type: ISequencedDocumentMessage[]
initialSignals
Get signals sent during the connection
Signature
get initialSignals(): ISignalMessage[];
Type: ISignalMessage[]
logger
- Implementors should manage their own logger or monitoring context
Signature
protected get logger(): ITelemetryLogger;
Type: ITelemetryLogger
maxMessageSize
Get the maximum size of a message before chunking is required
Signature
get maxMessageSize(): number;
Type: number
mode
Get the mode of the client
Signature
get mode(): ConnectionMode;
Type: ConnectionMode
queuedMessages
Signature
protected readonly queuedMessages: ISequencedDocumentMessage[];
Type: ISequencedDocumentMessage[]
queuedSignals
Signature
protected readonly queuedSignals: ISignalMessage[];
Type: ISignalMessage[]
serviceConfiguration
Configuration details provided by the service
Signature
get serviceConfiguration(): IClientConfiguration;
Type: IClientConfiguration
socket
Signature
protected readonly socket: Socket;
Type: Socket
version
Semver of protocol being used with the service
Signature
get version(): string;
Type: string
Method Details
addTrackedListener
Signature
protected addTrackedListener(event: string, listener: (...args: any[]) => void): void;
Parameters
Parameter | Type | Description |
---|---|---|
event | string | |
listener | (...args: any[]) => void |
createErrorObject
Error raising for socket.io issues
Signature
protected createErrorObject(handler: string, error?: any, canRetry?: boolean): IAnyDriverError;
Parameters
Parameter | Modifiers | Type | Description |
---|---|---|---|
handler | string | ||
error | optional | any | |
canRetry | optional | boolean |
Returns
Return type: IAnyDriverError
disconnect
Disconnect from the websocket.
Signature
protected disconnect(socketProtocolError: boolean, reason: IAnyDriverError): void;
Parameters
Parameter | Type | Description |
---|---|---|
socketProtocolError | boolean | true if error happened on socket / socket.io protocol level (not on Fluid protocol level) |
reason | IAnyDriverError | reason for disconnect |
dispose
Disconnect from the websocket, and permanently disable this DocumentDeltaConnection.
Signature
dispose(): void;
disposeCore
Signature
protected disposeCore(socketProtocolError: boolean, err: IAnyDriverError): void;
Parameters
Parameter | Type | Description |
---|---|---|
socketProtocolError | boolean | |
err | IAnyDriverError |
emitMessages
Signature
protected emitMessages(type: string, messages: IDocumentMessage[][]): void;
Parameters
Parameter | Type | Description |
---|---|---|
type | string | |
messages | IDocumentMessage[][] |
initialize
Signature
protected initialize(connectMessage: IConnect, timeout: number): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
connectMessage | IConnect | |
timeout | number |
Returns
Return type: Promise<void>
submit
Submits a new delta operation to the server
Signature
submit(messages: IDocumentMessage[]): void;
Parameters
Parameter | Type | Description |
---|---|---|
messages | IDocumentMessage[] |
submitCore
Signature
protected submitCore(type: string, messages: IDocumentMessage[]): void;
Parameters
Parameter | Type | Description |
---|---|---|
type | string | |
messages | IDocumentMessage[] |
submitSignal
Submits a new signal to the server
Signature
submitSignal(message: IDocumentMessage): void;
Parameters
Parameter | Type | Description |
---|---|---|
message | IDocumentMessage | signal to submit |