From 6ff1552063f12c3694d65648ad1c6e5e844dd0f5 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 29 Jan 2018 14:46:31 +0100 Subject: [PATCH] Fixed websocket --- platypush/backend/http/__init__.py | 2 +- platypush/backend/http/static/js/application.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platypush/backend/http/__init__.py b/platypush/backend/http/__init__.py index 0d3fae6b6..ea7d90cc6 100644 --- a/platypush/backend/http/__init__.py +++ b/platypush/backend/http/__init__.py @@ -124,7 +124,7 @@ class HttpBackend(Backend): loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) loop.run_until_complete( - websockets.serve(register_websocket, 'localhost', self.websocket_port)) + websockets.serve(register_websocket, '0.0.0.0', self.websocket_port)) loop.run_forever() diff --git a/platypush/backend/http/static/js/application.js b/platypush/backend/http/static/js/application.js index 0ea6987df..307bfde65 100644 --- a/platypush/backend/http/static/js/application.js +++ b/platypush/backend/http/static/js/application.js @@ -3,7 +3,7 @@ $(document).ready(function() { var eventListeners = []; var initWebsocket = function() { - websocket = new WebSocket('ws://localhost:' + window.websocket_port); + websocket = new WebSocket('ws://' + window.location.hostname + ':' + window.websocket_port); websocket.onmessage = function(event) { for (var listener of eventListeners) { data = event.data;