@latelier/vue-signalr

Signalr client for vue js
9,997 48
Install
npm install @latelier/vue-signalr
Latest Version:2.0.4
License:MIT
Last Updated:Jul 8, 2023
Links: GitHub  ·  npm
Maintainer: dragon_

vue-signalr

Installation

$ npm install @latelier/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)
    }
    
  }

});


Related Packages

@dreamonkey/vue-signalr

SignalR plugin for Vue 3

84,683 25
@quangdao/vue-signalr

SignalR plugin for Vue 3

4,484 21
@scanupload/qr-code-generator-vue

Vue 3 wrapper for the ScanUpload QR Code Generator — QR code component with real...

923
@dammers/use-signalr-vue

Fully-typed multi-hub SignalR plugin + composables for Vue.

436 2
@crestapps/ai-chat-ui

Browser-ready JavaScript widgets and CSS for CrestApps AI chat sessions and chat...

14,704 13

Version History

Version Released License
2.0.4 MIT
2.0.3 MIT
2.0.2 MIT
2.0.1 MIT
2.0.0 MIT