Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1602 from wolfejw86/feature/access-ws-configuration
Browse files Browse the repository at this point in the history
feature/access-ws-configuration-object
  • Loading branch information
benbrown authored Mar 11, 2019
2 parents 68f18dd + 81d0d8d commit 59c42c9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/Web.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 59c42c9

Please sign in to comment.