Search...
onConnected( )
Adds an event handler that runs when a connection or reconnection occurs.
Description
A connection occurs on the first subscription to a channel or channel resource or when an existing connection is lost and then restored.
Syntax
function onConnected(handler: ConnectionHandler): voidhandler: function ConnectionHandler(): void
onConnected Parameters
NAME
TYPE
DESCRIPTION
handler
The name of the function or the function expression to run when a connection occurs.
Returns
This function does not return anything.
Return Type:
void
ConnectionHandler 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 wixRealtime from 'wix-realtime';23// ...45wixRealtime.onConnected( () => {6 // handle connection7 $w("#disconnectedMessage").hide();8} );