Fixing callback type in send method for ws

This commit is contained in:
Ravaka Razafimanantsoa
2018-08-30 10:22:11 +09:00
parent 3be76f6b28
commit d227e139f6
2 changed files with 4 additions and 2 deletions
+2 -2
View File
@@ -44,8 +44,8 @@ declare class WebSocket extends events.EventEmitter {
close(code?: number, data?: string): void;
ping(data?: any, mask?: boolean, cb?: (err: Error) => void): void;
pong(data?: any, mask?: boolean, cb?: (err: Error) => void): void;
send(data: any, cb?: (err: Error) => void): void;
send(data: any, options: { mask?: boolean; binary?: boolean; compress?: boolean; fin?: boolean }, cb?: (err: Error) => void): void;
send(data: any, cb?: (err?: Error) => void): void;
send(data: any, options: { mask?: boolean; binary?: boolean; compress?: boolean; fin?: boolean }, cb?: (err?: Error) => void): void;
terminate(): void;
// HTML5 WebSocket events
+2
View File
@@ -22,6 +22,8 @@ import * as https from 'https';
wss.on('connection', (ws, req) => {
ws.on('message', (message) => console.log('received: %s', message));
ws.send('something');
ws.send('something', (error?: Error) => {});
ws.send('something', {}, (error?: Error) => {});
});
wss.on('upgrade', (res) => {