瀏覽代碼

Fix websocket connection in production

Thomas Dy 7 年之前
父節點
當前提交
a0b0177495
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      public/javascripts/chatServices.js

+ 2 - 2
public/javascripts/chatServices.js

@@ -52,8 +52,8 @@ angular.module('chatServices', [])
     service.status = 'connecting';
 
     var url = jsRoutes.controllers.Application.chat(username, getRoom()).webSocketURL();
-    if(window.location.hostname == "gamenchat.pleasantprogrammer.com" && window.location.port == "") {
-      url = url.replace("gamenchat.pleasantprogrammer.com", "$&:8000");
+    if(window.location.protocol == 'https:') {
+      url = url.replace('ws:', 'wss:');
     }
     chatSocket = new WS(url);
     chatSocket.onmessage = wrap(function(event) {