mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Added https type to Websocket.Server (#11213)
* Added https type to Websocket.Server Hi, the current typing misses to pass to the Websocket.Server server option a https Server. Cheers meno * * added a test * fix the missing typo of http(s) * improve the test
This commit is contained in:
committed by
Masahiro Wakame
parent
489541498b
commit
ef6b6ef139
+8
-1
@@ -2,6 +2,7 @@
|
||||
|
||||
import * as WebSocket from 'ws';
|
||||
import * as http from'http';
|
||||
import * as https from'https';
|
||||
|
||||
var WebSocketServer = WebSocket.Server;
|
||||
|
||||
@@ -54,6 +55,12 @@ var WebSocketServer = WebSocket.Server;
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
new WebSocket.Server({ server: https.createServer({}) });
|
||||
new WebSocket.Server({ server: http.createServer() });
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
const verifyClient = function(
|
||||
info: {
|
||||
@@ -73,4 +80,4 @@ var WebSocketServer = WebSocket.Server;
|
||||
wsv.on('connection', function connection(ws) {
|
||||
console.log(ws.protocol)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -8,6 +8,7 @@
|
||||
declare module "ws" {
|
||||
import * as events from 'events';
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
import * as net from 'net';
|
||||
|
||||
class WebSocket extends events.EventEmitter {
|
||||
@@ -99,7 +100,7 @@ declare module "ws" {
|
||||
export interface IServerOptions {
|
||||
host?: string;
|
||||
port?: number;
|
||||
server?: http.Server;
|
||||
server?: http.Server | https.Server;
|
||||
verifyClient?: VerifyClientCallbackAsync | VerifyClientCallbackSync;
|
||||
handleProtocols?: any;
|
||||
path?: string;
|
||||
|
||||
Reference in New Issue
Block a user