Search.../

onDisconnected( )

Adds an event handler that runs when a disconnection occurs.

Description

A disconnection can occur, for example, if there is a network issue.

Syntax

function onDisconnected(handler: DisconnectionHandler): void
handler: function DisconnectionHandler(): void

onDisconnected Parameters

NAME
TYPE
DESCRIPTION
handler

DisconnectionHandler

The name of the function or the function expression to run when a disconnection occurs.

Returns

This function does not return anything.

Return Type:

void

DisconnectionHandler Parameters

This function does not take any parameters.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

Add a connection handler

Code Example

Copy Code
1import wixRealtime from 'wix-realtime';
2
3// ...
4
5wixRealtime.onDisconnected( () => {
6 // handle disconnection
7 $w("#disconnectedMessage").show();
8} );