( conn: Conn, clientId: string, sessionId: string, )
| 208 | } |
| 209 | |
| 210 | async function helloAndSubscribe( |
| 211 | conn: Conn, |
| 212 | clientId: string, |
| 213 | sessionId: string, |
| 214 | ): Promise<void> { |
| 215 | await receiveType(conn, 'server_hello', 1000); |
| 216 | conn.ws.send( |
| 217 | JSON.stringify({ |
| 218 | type: 'client_hello', |
| 219 | id: `cli_${clientId}`, |
| 220 | payload: { client_id: clientId, subscriptions: [sessionId] }, |
| 221 | }), |
| 222 | ); |
| 223 | await receiveType(conn, 'ack', 1000); |
| 224 | } |
| 225 | |
| 226 | const sleep = (ms: number): Promise<void> => |
| 227 | new Promise((r) => setTimeout(r, ms)); |
no test coverage detected