title: connection error in signalR in Vuex on VueJS
body: <p>I'm trying to connect signalR using the Vuex store in VueJS, but when it is time to connect subscriptions, I get an error</p>
  
  <p>I break the repository into several files</p>
  
  <p>store index.js</p>
  
  <pre><code>import Vue from 'vue'
  import Vuex from 'vuex'
  
  import SignalR from './modules/signalR'
  
  
  Vue.use(Vuex)
  
  const store = () =&gt;
    new Vuex.Store({
      modules: {
        signalR: SignalR
      }
    });
  
  export default store
  </code></pre>
  
  <p>SignalR main connection file signalR/index.js</p>
  
  <pre><code>const signalR = require('@aspnet/signalr')
  const Cookie = process.client ? require("js-cookie") : undefined;
  
  export default {
    state: {
      connection: null
    },
  </code></pre>
  
  <p>I declare actions which I cause through dispatch in the main component of the application</p>
  
  <pre><code>  actions: {
      connectSignalR(context, data) {
        var token = Cookie.get("authToken");
        console.log('signalR', token)  
  
        context.state.connection == null ? context.state = new signalR.HubConnectionBuilder().withUrl(context.getters.base_signalr + "/notification",
        { accessTokenFactory: () =&gt; token }).build()
        : false
  
        let startedPromise = null
        function start() {
          startedPromise = context.state.connection.start()
          .catch(error =&gt; {
            console.log('Failed to connect with hun', error)
            return new Promise((resolve, reject) =&gt; 
              setTimeout(() =&gt; start().then(resolve).catch(reject), 5000))
          })
          return startedPromise
        }
  
        context.state.connection.onclose(() =&gt; start())
  
        //context.state.connection.connectionSlow(function() {
        //  console.log('slow connection...');
        //});
  
        context.state.connection.on('support', (data) =&gt; {
          console.log(data);
        })
  
        start()
      }
    }
  }
  </code></pre>
  
  <p>error</p>
  
  <pre><code>TypeError: context.state.connection.connectionSlow is not a function
  at Store.connectSignalR
  </code></pre>
  
  <p>or </p>
  
  <pre><code>TypeError: context.state.connection.on is not a function
  at Store.connectSignalR
  </code></pre>