File size: 437 Bytes
35fc662
 
e3cb794
 
 
 
 
 
d32b1fb
35fc662
 
 
 
 
 
 
 
 
e3cb794
d32b1fb
35fc662
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { WebSocket } from "ws";

export interface WebSocketInterface {
    send: (data: string | Buffer) => void;
    readyState: () => 0 | 1 | 2 | 3;
}

export default class WebSocketWrapper implements WebSocketInterface {
    ws: WebSocket;

    constructor(ws: WebSocket) {
        this.ws = ws;
    }

    send(data: string | Buffer) {
        this.ws.send(data);
    }

    readyState() {
        return this.ws.readyState;
    }
}