1
+ export class RealtimeAPI extends RealtimeEventHandler {
2
+ /**
3
+ * Create a new RealtimeAPI instance
4
+ * @param {{url?: string, apiKey?: string, dangerouslyAllowAPIKeyInBrowser?: boolean, debug?: boolean} } [settings]
5
+ * @returns {RealtimeAPI }
6
+ */
7
+ constructor ( { url, apiKey, dangerouslyAllowAPIKeyInBrowser, debug } ?: {
8
+ url ?: string ;
9
+ apiKey ?: string ;
10
+ dangerouslyAllowAPIKeyInBrowser ?: boolean ;
11
+ debug ?: boolean ;
12
+ } ) ;
13
+ defaultUrl : string ;
14
+ url : string ;
15
+ apiKey : string ;
16
+ debug : boolean ;
17
+ ws : any ;
18
+ /**
19
+ * Tells us whether or not the WebSocket is connected
20
+ * @returns {boolean }
21
+ */
22
+ isConnected ( ) : boolean ;
23
+ /**
24
+ * Writes WebSocket logs to console
25
+ * @param {...any } args
26
+ * @returns {true }
27
+ */
28
+ log ( ...args : any [ ] ) : true ;
29
+ /**
30
+ * Connects to Realtime API Websocket Server
31
+ * @param {{model?: string} } [settings]
32
+ * @returns {Promise<true> }
33
+ */
34
+ connect ( model ?: string ) : Promise < true > ;
35
+ /**
36
+ * Disconnects from Realtime API server
37
+ * @param {WebSocket } [ws]
38
+ * @returns {true }
39
+ */
40
+ disconnect ( ws ?: WebSocket ) : true ;
41
+ /**
42
+ * Receives an event from WebSocket and dispatches as "server.{eventName}" and "server.*" events
43
+ * @param {string } eventName
44
+ * @param {{[key: string]: any} } event
45
+ * @returns {true }
46
+ */
47
+ receive ( eventName : string , event : {
48
+ [ key : string ] : any ;
49
+ } ) : true ;
50
+ /**
51
+ * Sends an event to WebSocket and dispatches as "client.{eventName}" and "client.*" events
52
+ * @param {string } eventName
53
+ * @param {{[key: string]: any} } event
54
+ * @returns {true }
55
+ */
56
+ send ( eventName : string , data : any ) : true ;
57
+ }
58
+ import { RealtimeEventHandler } from './event_handler.js' ;
59
+ //# sourceMappingURL=api.d.ts.map
0 commit comments