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 } ?: {
35+ model ?: string ;
36+ } ) : Promise < true > ;
37+ /**
38+ * Disconnects from Realtime API server
39+ * @param {WebSocket } [ws]
40+ * @returns {true }
41+ */
42+ disconnect ( ws ?: WebSocket ) : true ;
43+ /**
44+ * Receives an event from WebSocket and dispatches as "server.{eventName}" and "server.*" events
45+ * @param {string } eventName
46+ * @param {{[key: string]: any} } event
47+ * @returns {true }
48+ */
49+ receive ( eventName : string , event : {
50+ [ key : string ] : any ;
51+ } ) : true ;
52+ /**
53+ * Sends an event to WebSocket and dispatches as "client.{eventName}" and "client.*" events
54+ * @param {string } eventName
55+ * @param {{[key: string]: any} } event
56+ * @returns {true }
57+ */
58+ send ( eventName : string , data : any ) : true ;
59+ }
60+ import { RealtimeEventHandler } from './event_handler.js' ;
61+ //# sourceMappingURL=api.d.ts.map
0 commit comments