1 |
|
2 | import * as events from 'events';
|
3 | import * as WebSocket from 'ws';
|
4 | export interface CommServerConnectionPayload {
|
5 | event: 'connect';
|
6 | device: string;
|
7 | }
|
8 | export interface CommServer {
|
9 | on(event: 'error', listener: (err: Error) => void): this;
|
10 | on(event: 'connect', listener: (data: CommServerConnectionPayload) => void): this;
|
11 | }
|
12 | export declare class CommServer extends events.EventEmitter {
|
13 | namespace: string;
|
14 | |
15 |
|
16 |
|
17 | id: string;
|
18 | |
19 |
|
20 |
|
21 | port: number;
|
22 | protected server?: WebSocket.Server;
|
23 | constructor(namespace: string,
|
24 | |
25 |
|
26 |
|
27 | id: string,
|
28 | |
29 |
|
30 |
|
31 | port: number);
|
32 | get clients(): Set<WebSocket>;
|
33 | start(): Promise<void>;
|
34 | private parseData;
|
35 | stop(): Promise<void>;
|
36 | }
|