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:
Meno Abels
2016-09-14 22:11:22 +09:00
committed by Masahiro Wakame
parent 489541498b
commit ef6b6ef139
2 changed files with 10 additions and 2 deletions
+8 -1
View File
@@ -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
View File
@@ -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;