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. |
Members
serverInstance
Gets the server instance associated with the connection.
socket :Object
The socket object representing the connection.
Type:
- Object
subscriptions :Array
Array to store active subscriptions.
Type:
- Array
Methods
_serverInstance() → {Object}
Returns the server instance associated with the connection.
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. |
Returns:
- The component object.
- Type
- Object
emitConnectionStatus()
Emits connection status to the client.
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. |
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. |
Returns:
- The subscription object.
- Type
- Object
init()
Initializes socket event listeners and connection status.
onConnectionStatus()
Handles 'connection:status' event by emitting connection status.
(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. |
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. |
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. |
Returns:
- The updated component object.
- Type
- Object