/* globals localStorage */

import store from '../store'

var messageCalloutWS = null
var url = null

export default {

  openWebSockets () {
    console.log('Opening websockets')
    url = 'ws://174.138.4.3:9111/v3/ws/messagecallout/'
    messageCalloutWS = new WebSocket(url)
    // Show a connected message when the WebSocket is opened.
    messageCalloutWS.addEventListener('open', function (e) {
      console.log('open', e)
    })
    messageCalloutWS.onmessage = function (event) {
      if (store.isMobile) {
        console.log('mobile')
      } else {
        console.log('desktop')
      }
      console.log(event.data)
    }
    messageCalloutWS.onerror = function () {
     // notify user about connection error
      console.log('websocket error')
    }
  },
  closeWebSockets () {
    console.log('Closing messageCalloutWS')
    if (messageCalloutWS !== null) {
      messageCalloutWS.close()
    }
  }
}

@@ -55,29 +55,20 @@
 e'%0A%0Avar 
-messageCallou
+even
 tWS = nu
@@ -84,16 +84,52 @@
 l = null
+%0Avar host = window.location.hostname
 %0A%0Aexport
@@ -201,188 +201,283 @@
 kets
-')%0A    url = 'ws://174.138.4.3:9111/v3/ws/messagecallout/'%0A    messageCalloutWS = new WebSocket(url)%0A    // Show a connected message when the WebSocket is opened.%0A    messageCallou
+ ' + host)%0A    if (process.env.NODE_ENV === 'development' %7C%7C window.location.host === 'fd-vue-webapp.herokuapp.com') %7B%0A      url = 'ws://174.138.4.3:9111/v3/ws/event/'%0A    %7D else %7B%0A      url = 'ws://localhost:9111/v3/ws/event/'%0A    %7D%0A    eventWS = new WebSocket(url)%0A    even
 tWS.
@@ -535,20 +535,38 @@
 le.log('
+event websocket 
 open
+ed
 ', e)%0A  
@@ -570,37 +570,28 @@
 %0A    %7D)%0A    
-messageCallou
+even
 tWS.onmessag
@@ -761,37 +761,28 @@
 )%0A    %7D%0A    
-messageCallou
+even
 tWS.onerror 
@@ -963,29 +963,20 @@
     if (
-messageCallou
+even
 tWS !== 
@@ -989,29 +989,20 @@
 %7B%0A      
-messageCallou
+even
 tWS.clos

Update websocket reference