summaryrefslogtreecommitdiffstats
path: root/webapp/components/logged_in.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-03-23 10:20:52 -0400
committerChristopher Speller <crspeller@gmail.com>2016-03-23 10:38:35 -0400
commit9239a7353af2c67a6778ff4cabd164db62087bde (patch)
tree78335a5254885058ed3b224a4b050db03c732bb3 /webapp/components/logged_in.jsx
parent6568e15023c009c96a46f022236f5fd4415445c0 (diff)
downloadchat-9239a7353af2c67a6778ff4cabd164db62087bde.tar.gz
chat-9239a7353af2c67a6778ff4cabd164db62087bde.tar.bz2
chat-9239a7353af2c67a6778ff4cabd164db62087bde.zip
Fixing websocket connection issue. Refactoring websockets into an action creator.
Diffstat (limited to 'webapp/components/logged_in.jsx')
-rw-r--r--webapp/components/logged_in.jsx13
1 files changed, 4 insertions, 9 deletions
diff --git a/webapp/components/logged_in.jsx b/webapp/components/logged_in.jsx
index 6d35ff8c2..7ddb6b83d 100644
--- a/webapp/components/logged_in.jsx
+++ b/webapp/components/logged_in.jsx
@@ -5,12 +5,12 @@ import $ from 'jquery';
import * as AsyncClient from 'utils/async_client.jsx';
import * as GlobalActions from 'action_creators/global_actions.jsx';
import UserStore from 'stores/user_store.jsx';
-import SocketStore from 'stores/socket_store.jsx';
import ChannelStore from 'stores/channel_store.jsx';
import PreferenceStore from 'stores/preference_store.jsx';
import * as Utils from 'utils/utils.jsx';
import Constants from 'utils/constants.jsx';
import ErrorBar from 'components/error_bar.jsx';
+import * as Websockets from 'action_creators/websocket_actions.jsx';
import {browserHistory} from 'react-router';
@@ -66,11 +66,6 @@ export default class LoggedIn extends React.Component {
}
}
}
- onSocketChange(msg) {
- if (msg && msg.user_id && msg.user_id !== UserStore.getCurrentId()) {
- UserStore.setStatus(msg.user_id, 'online');
- }
- }
componentWillMount() {
// Emit view action
GlobalActions.viewLoggedIn();
@@ -78,8 +73,8 @@ export default class LoggedIn extends React.Component {
// Listen for user
UserStore.addChangeListener(this.onUserChanged);
- // Add listner for socker store
- SocketStore.addChangeListener(this.onSocketChange);
+ // Initalize websockets
+ Websockets.initialize();
// Get all statuses regularally. (Soon to be switched to websocket)
this.intervalId = setInterval(() => AsyncClient.getStatuses(), CLIENT_STATUS_INTERVAL);
@@ -178,7 +173,7 @@ export default class LoggedIn extends React.Component {
$(window).off('focus');
$(window).off('blur');
- SocketStore.removeChangeListener(this.onSocketChange);
+ Websockets.close();
UserStore.removeChangeListener(this.onUserChanged);
$('body').off('click.userpopover');