mirror of
https://github.com/syuilo/ai.git
synced 2024-11-09 23:48:01 +00:00
18 lines
327 B
TypeScript
18 lines
327 B
TypeScript
|
import * as websocket from 'websocket';
|
||
|
|
||
|
export class StreamingApi {
|
||
|
private ws: WS;
|
||
|
|
||
|
constructor() {
|
||
|
this.ws = new WS('ws://localhost/streaming');
|
||
|
}
|
||
|
|
||
|
public async waitForMainChannelConnected() {
|
||
|
await expect(this.ws).toReceiveMessage("hello");
|
||
|
}
|
||
|
|
||
|
public send(message) {
|
||
|
this.ws.send(JSON.stringify(message));
|
||
|
}
|
||
|
}
|