- //Notifications
- showNotification = (data) => {
- let state = {
- displayNotification: true,
- notificationMessage: data,
- notificationType: 'error',
- displayScreenLoader: false
- }
- if(typeof(data) == 'string') {
-
- } else {
- state.notificationMessage = data.msg;
- if(data.type) {
- state.notificationType = data.type;
+ openProjectSocketSuccess = (connection) => {
+ var self = this;
+ var ws = window.multiplexer.channel(connection);
+ if (!connection) return;
+ self.setState({
+ socket: ws.ws,
+ channelId: connection
+ });
+ ws.onmessage = function(socket) {
+ try {
+ var data = JSON.parse(socket.data);
+ Utils.checkAuthentication(data.statusCode, function() {
+ self.closeSocket();
+ });
+ if (!data.project || !_isEqual(data.project, self.projects)) {
+ let user = self.user;
+ user.projects = data.project;
+ self.setState({
+ user: user,
+ projects: data.project || {}
+ });
+ }
+ } catch(e) {
+ console.log('HIT an exception in openProjectSocketSuccess', e);