| 16 | | 'CLOSED'; |
| 17 | |
| 18 | export interface SyncTransport { |
| 19 | isOpen: boolean; |
| 20 | connectionStatus: ConnectionStatus; |
| 21 | /** |
| 22 | * Sends a message to the server. If the message could not be sent, this should return false. If successfully sent, this should return true. |
| 23 | */ |
| 24 | sendMessage(message: ClientSyncMessage): boolean; |
| 25 | /** |
| 26 | * Connect to the server with the given parameters. If this transport is already connected, it should close the existing connection and open a new one. |
| 27 | */ |
| 28 | connect(params: TransportConnectParams): void; |
| 29 | /** |
| 30 | * Closes the connection to the server. If the transport is not connected, this should be a no op. |
| 31 | */ |
| 32 | close(reason?: CloseReason): void; |
| 33 | onClose(callback: (ev: any) => void): void; |
| 34 | /** |
| 35 | * @deprecated Triplit Client now manages its own connection state, so this is no longer needed. |
| 36 | */ |
| 37 | onConnectionChange(callback: (state: ConnectionStatus) => void): void; |
| 38 | onError(callback: (ev: any) => void): void; |
| 39 | onMessage(callback: (message: any) => void): void; |
| 40 | onOpen(callback: (ev: any) => void): void; |
| 41 | } |
| 42 | |
| 43 | export type TransportConnectParams = { |
| 44 | server: string; |
no outgoing calls
no test coverage detected