camstreamerlib
Version:
Helper library for CamStreamer ACAP applications.
19 lines (18 loc) • 458 B
JavaScript
import { WsClient } from './WsClient';
export class WsEventClient {
wsClient;
constructor(options) {
this.wsClient = new WsClient(options);
this.wsClient.on('message', (data) => {
this.onmessage?.({ data: data.toString() });
});
}
send = (data) => {
this.wsClient.send(data);
};
destroy = () => {
this.wsClient.close();
this.onmessage = null;
};
onmessage = null;
}