DocumentDeltaConnection Class

Packages > @fluidframework/driver-base > DocumentDeltaConnection

Represents a connection to a stream of delta updates

Signature:

export declare class DocumentDeltaConnection extends TypedEventEmitter<IDocumentDeltaConnectionEvents> implements IDocumentDeltaConnection 

Extends: TypedEventEmitter<IDocumentDeltaConnectionEvents>

Implements: IDocumentDeltaConnection

Constructors

List of constructors for this class
Constructor Modifiers Description
(constructor)(socket, documentId, logger) Constructs a new instance of the DocumentDeltaConnection class

Properties

List of properties for this class
Property Modifiers Type Description
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
closed 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.
details IConnected
documentId string
earlyOpHandler (documentId: string, msgs: ISequencedDocumentMessage[]) => void
earlySignalHandler (msg: ISignalMessage) => void
eventsToForward static string[]
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 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 SocketIOClient.Socket
submitManager BatchManager<IDocumentMessage[]>
version string Semver of protocol being used with the service

Methods

List of methods on this class
Method Modifiers Description
addTrackedListener(event, listener)
close() Disconnect from the websocket, and permanently disable this DocumentDeltaConnection.
closeCore(socketProtocolError, err)
createErrorObject(handler, error, canRetry) Error raising for socket.io issues
disconnect(socketProtocolError, reason) Disconnect from the websocket.
initialize(connectMessage, timeout)
submit(messages) Submits a new delta operation to the server
submitSignal(message) Submits a new signal to the server

Constructors

DocumentDeltaConnection.(constructor)

Constructs a new instance of the DocumentDeltaConnection class

Signature:

protected constructor(socket: SocketIOClient.Socket, documentId: string, logger: ITelemetryLogger);

Parameters

List of parameters
Parameter Type Description
socket SocketIOClient.Socket websocket to be used
documentId string ID of the document
logger ITelemetryLogger

Properties

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;

claims

Get the claims of the client who is sending the message

Signature:

get claims(): ITokenClaims;

clientId

Get the ID of the client who is sending the message

Signature:

get clientId(): string;

closed

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 closed: boolean;

details

Signature:

get details(): IConnected;

documentId

Signature:

documentId: string;

earlyOpHandler

Signature:

protected earlyOpHandler: (documentId: string, msgs: ISequencedDocumentMessage[]) => void;

earlySignalHandler

Signature:

protected earlySignalHandler: (msg: ISignalMessage) => void;

eventsToForward

Signature:

static readonly eventsToForward: string[];

existing

Get whether or not this is an existing document

Signature:

get existing(): boolean;

hasDetails

Signature:

protected get hasDetails(): boolean;

initialClients

Get initial client list

Signature:

get initialClients(): ISignalClient[];

initialMessages

Get messages sent during the connection

Signature:

get initialMessages(): ISequencedDocumentMessage[];

initialSignals

Get signals sent during the connection

Signature:

get initialSignals(): ISignalMessage[];

logger

Signature:

protected readonly logger: ITelemetryLogger;

maxMessageSize

Get the maximum size of a message before chunking is required

Signature:

get maxMessageSize(): number;

mode

Get the mode of the client

Signature:

get mode(): ConnectionMode;

queuedMessages

Signature:

protected readonly queuedMessages: ISequencedDocumentMessage[];

queuedSignals

Signature:

protected readonly queuedSignals: ISignalMessage[];

serviceConfiguration

Configuration details provided by the service

Signature:

get serviceConfiguration(): IClientConfiguration;

socket

Signature:

protected readonly socket: SocketIOClient.Socket;

submitManager

Signature:

protected readonly submitManager: BatchManager<IDocumentMessage[]>;

version

Semver of protocol being used with the service

Signature:

get version(): string;

Methods

addTrackedListener

Signature:

protected addTrackedListener(event: string, listener: (...args: any[]) => void): void;

Parameters

List of parameters
Parameter Type Description
event string
listener (...args: any[]) => void

Returns:

void

close

Disconnect from the websocket, and permanently disable this DocumentDeltaConnection.

Signature:

close(): void;

Returns:

void

closeCore

Signature:

protected closeCore(socketProtocolError: boolean, err: DriverError): void;

Parameters

List of parameters
Parameter Type Description
socketProtocolError boolean
err DriverError

Returns:

void

createErrorObject

Error raising for socket.io issues

Signature:

protected createErrorObject(handler: string, error?: any, canRetry?: boolean): DriverError;

Parameters

List of parameters
Parameter Type Description
handler string
error any
canRetry boolean

Returns:

DriverError

disconnect

Disconnect from the websocket.

Signature:

protected disconnect(socketProtocolError: boolean, reason: DriverError): void;

Parameters

List of parameters
Parameter Type Description
socketProtocolError boolean true if error happened on socket / socket.io protocol level (not on Fluid protocol level)
reason DriverError reason for disconnect

Returns:

void

initialize

Signature:

protected initialize(connectMessage: IConnect, timeout: number): Promise<void>;

Parameters

List of parameters
Parameter Type Description
connectMessage IConnect
timeout number

Returns:

Promise<void>

submit

Submits a new delta operation to the server

Signature:

submit(messages: IDocumentMessage[]): void;

Parameters

List of parameters
Parameter Type Description
messages IDocumentMessage[]

Returns:

void

submitSignal

Submits a new signal to the server

Signature:

submitSignal(message: IDocumentMessage): void;

Parameters

List of parameters
Parameter Type Description
message IDocumentMessage signal to submit

Returns:

void