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

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

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