diff --git a/lib/Web.js b/lib/Web.js index 1d4e5d337..47410b139 100644 --- a/lib/Web.js +++ b/lib/Web.js @@ -11,11 +11,16 @@ function WebBot(configuration) { controller.excludeFromConversations(['hello', 'welcome_back', 'reconnect']); - controller.openSocketServer = function(server) { + /** + * wsConfiguration is an object that accepts the normal `ws` configuration object + * see `https://github.com/websockets/ws/blob/HEAD/doc/ws.md#new-websocketserveroptions-callback` + */ + controller.openSocketServer = function(server, wsConfiguration = {}) { // create the socket server along side the existing webserver. var wss = new WebSocket.Server({ - server + server, + ...wsConfiguration, }); // Expose the web socket server object to the controller so it can be used later.