diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-06-26 11:39:24 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-06-26 08:39:24 -0700 |
commit | e285839ee1322b8f16bdd15b76ef2d0f62bf154f (patch) | |
tree | 89a1501ef957a932a9fa587198810842fdc5df33 /webapp | |
parent | 23ccfc845ca2350075f6027e16c6206fc7b71716 (diff) | |
download | chat-e285839ee1322b8f16bdd15b76ef2d0f62bf154f.tar.gz chat-e285839ee1322b8f16bdd15b76ef2d0f62bf154f.tar.bz2 chat-e285839ee1322b8f16bdd15b76ef2d0f62bf154f.zip |
Fix websocket URL when specifying port in the config (#6748)
Diffstat (limited to 'webapp')
-rw-r--r-- | webapp/actions/websocket_actions.jsx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/webapp/actions/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx index 1cdd06599..72be226cc 100644 --- a/webapp/actions/websocket_actions.jsx +++ b/webapp/actions/websocket_actions.jsx @@ -31,6 +31,7 @@ const getState = store.getState; import {batchActions} from 'redux-batched-actions'; import {Client4} from 'mattermost-redux/client'; +import {getSiteURL} from 'utils/url.jsx'; import * as TeamActions from 'mattermost-redux/actions/teams'; import {viewChannel, getChannelAndMyMember, getChannelStats} from 'mattermost-redux/actions/channels'; @@ -46,7 +47,7 @@ export function initialize() { return; } - let connUrl = Client4.getWebSocketUrl(); + let connUrl = getSiteURL(); // replace the protocol with a websocket one if (connUrl.startsWith('https:')) { @@ -56,7 +57,7 @@ export function initialize() { } // append a port number if one isn't already specified - if (!(/:\d+/).test(connUrl)) { + if (!(/:\d+$/).test(connUrl)) { if (connUrl.startsWith('wss:')) { connUrl += ':' + global.window.mm_config.WebsocketSecurePort; } else { @@ -64,6 +65,8 @@ export function initialize() { } } + connUrl += Client4.getUrlVersion() + '/websocket'; + WebSocketClient.setEventCallback(handleEvent); WebSocketClient.setFirstConnectCallback(handleFirstConnect); WebSocketClient.setReconnectCallback(() => reconnect(false)); |