Class: SocketConnection

SocketConnection(socket, serverInstance)

Manages socket connections and subscriptions.

Constructor

new SocketConnection(socket, serverInstance)

Creates an instance of SocketConnection.

Parameters:
Name Type Description
socket Object

The socket object representing the connection.

serverInstance Object

The server instance associated with the connection.

Source:

Members

serverInstance

Gets the server instance associated with the connection.

Source:

socket :Object

The socket object representing the connection.

Type:
  • Object
Source:

subscriptions :Array

Array to store active subscriptions.

Type:
  • Array
Source:

Methods

_serverInstance() → {Object}

Returns the server instance associated with the connection.

Source:
Returns:
  • The server instance.
Type
Object

appendComponent(subscription) → {Object}

Appends a component subscription to the subscribed components list.

Parameters:
Name Type Description
subscription Object

The component subscription instance.

Source:
Returns:
  • The component object.
Type
Object

emitConnectionStatus()

Emits connection status to the client.

Source:

getComponent(subscriptionUID) → {Object}

Gets the component object associated with the provided subscription UID.

Parameters:
Name Type Description
subscriptionUID string

The unique identifier for the component subscription.

Source:
Returns:
  • The component object.
Type
Object

getSubscription(subscriptionUID) → {Object}

Gets the subscription object associated with the provided subscription UID.

Parameters:
Name Type Description
subscriptionUID string

The unique identifier for the subscription.

Source:
Returns:
  • The subscription object.
Type
Object

init()

Initializes socket event listeners and connection status.

Source:

onConnectionStatus()

Handles 'connection:status' event by emitting connection status.

Source:

(async) subscribeComponent(setup) → {Object}

Subscribes to a component based on the provided setup.

Parameters:
Name Type Description
setup Object

Configuration options for the component subscription.

Source:
Returns:
  • The component subscription instance.
Type
Object

(async) subscribeDOC(setup) → {Object}

Subscribes to a document based on the provided setup.

Parameters:
Name Type Description
setup Object

Configuration options for the document subscription.

Source:
Returns:
  • The document subscription instance.
Type
Object

updateComponent(subscriptionUID, mergeData) → {Object}

Updates the component associated with the provided subscription UID using merge data.

Parameters:
Name Type Description
subscriptionUID string

The unique identifier for the component subscription.

mergeData Object

The data used for merging and updating the component.

Source:
Returns:
  • The updated component object.
Type
Object