diff --git a/js/libtextsecure.js b/js/libtextsecure.js index e79a85298..fb4ed6143 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -38563,7 +38563,14 @@ TextSecureWebSocket = function (url, opts) { ); }; - window.WebSocketResource = function(socket, handleRequest, keepalive) { + window.WebSocketResource = function(socket, opts) { + opts = opts || {}; + var handleRequest = opts.handleRequest; + if (typeof handleRequest !== 'function') { + handleRequest = function(request) { + request.respond(404); + }; + } this.sendRequest = function(options) { return new OutgoingWebSocketRequest(options, socket); }; diff --git a/libtextsecure/websocket-resources.js b/libtextsecure/websocket-resources.js index 4f0972ed3..c613849a4 100644 --- a/libtextsecure/websocket-resources.js +++ b/libtextsecure/websocket-resources.js @@ -92,7 +92,14 @@ ); }; - window.WebSocketResource = function(socket, handleRequest, keepalive) { + window.WebSocketResource = function(socket, opts) { + opts = opts || {}; + var handleRequest = opts.handleRequest; + if (typeof handleRequest !== 'function') { + handleRequest = function(request) { + request.respond(404); + }; + } this.sendRequest = function(options) { return new OutgoingWebSocketRequest(options, socket); };