Commits

Jeffrey Gelens committed 273af74

Listening on 0.0.0.0

Comments (0)

Files changed (2)

examples/chat/chat.py

     return render_template('index.html')
 
 WebSocketServer(
-    ('', 8000),
+    ('0.0.0.0', 8000),
     Resource({
-        '/chat': ChatApplication,
-        '/.*': DebuggedApplication(flask_app)
+        '^/chat': ChatApplication,
+        '^/.*': DebuggedApplication(flask_app)
     }),
     debug=False
 ).serve_forever()

examples/chat/templates/index.html

 
         <script>
             var nickname = $('.nickname').val();
-            var ws = new WebSocket('ws://localhost:8000/chat');
+            var ws = new WebSocket('ws://' + window.location.hostname +':8000/chat');
 
             ws.onopen = function () { $('.connecting_status').text('connected'); }