1.0.9 • Published 4 years ago

@apavelm/vue-signalr v1.0.9

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

vue-signalr

Installation

$ npm install @apavelm/vue-signalr --save

Get started

import Vue from "vue";
import VueSignalR from "vue-signalr";

Vue.use(VueSignalR, "SOCKET_URL");

new Vue({
  el: "#app",
  render: h => h(App),

  created() {
    this.$socket.start({
      log: false // Active only in development for debugging.
    });
  }
});

Example with component

Vue.extend({

  ...

  methods: {

    someMethod() {
      this.$socket.invoke('socketName', payloadData)
        .then(response => {
          ...
        })
    }

    async someAsyncMethod() {
      const response = await this.$socket.invoke('socketName', payloadData)
      ...
    }

  },

  // Register your listener here.
  sockets: {

    // Equivalent of
    // signalrHubConnection.on('someEvent', (data) => this.someActionWithData(data))
    someEvent(data) {
      this.someActionWithData(data)
    }

    otherSomeEvent(data) {
      this.otheSomeActionWithOtherSomeData(data)
    }

  }

});
1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago