You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instantiate a new Resonate client. The following options can be passed in:
10
+
11
+
-`playerId`, required, a unique identifier for the player.
12
+
-`url`, required, the URL of the Resonate server to connect to.
13
+
-`logger`, optional, a logger instance to use for logging messages. If not provided, the console will be used for logging.
14
+
15
+
### `connect(isReconnect: bool)`
16
+
17
+
Connect to the Resonate server.
18
+
19
+
-`isReconnect` is a boolean indicating whether this is a reconnection attempt. Trackin this allows the player to populate the `expected` field on the `close` event.
20
+
21
+
### `disconnect()`
22
+
23
+
Disconnect from the Resonate server.
24
+
25
+
## Events
26
+
27
+
type Events = {
28
+
open: void;
29
+
close: { expected: boolean };
30
+
"server-update": ServerInfo | null;
31
+
"session-update": SessionInfo | null;
32
+
"metadata-update": Metadata | null;
33
+
};
34
+
35
+
### `open`
36
+
37
+
Fired when the connection has been established with the Resonate server.
38
+
39
+
### `close`
40
+
41
+
Fired when the connection to the Resonate server has been closed.
42
+
43
+
Event data contains an `expected` boolean indicating whether the disconnection was expected (`disconnect()` called) or unexpected (e.g., due to a network issue).
44
+
45
+
### `server-update`
46
+
47
+
Fired when the server information has been updated. Event data is the server info.
48
+
49
+
### `session-update`
50
+
51
+
Fired when the session information has been updated. Event data is the session info.
52
+
53
+
### `metadata-update`
54
+
55
+
Fired when the metadata has been updated. Event data is the metadata.
0 commit comments