@dammers/use-signalr-vue

Fully-typed multi-hub SignalR plugin + composables for Vue.
436 2
Install
npm install @dammers/use-signalr-vue
Latest Version:1.0.0
Vue:3
License:MIT
Last Updated:Oct 1, 2026
Links: GitHub  ·  npm
Maintainer: dammers

@dammers/use-signalr-vue

Plugin and composables for typed SignalR in Vue. Part of use-signalr.

npm license

Install

npm install @dammers/use-signalr-vue @microsoft/signalr

It needs Vue ^3.3, @microsoft/signalr ^8 || ^9 || ^10, and Node 20.19 or later.

Example

This file declares a hub, connects it, and reads a typed method result:

import { createApp, ref } from "vue";
import { createSignalRClient, method } from "@dammers/use-signalr-vue";
import App from "./App.vue";

export const signalR = createSignalRClient({
  hubs: {
    "/hubs/rooms": {
      methods: { GetHistory: method<[roomId: string], { text: string }[]>() },
    },
  },
});

createApp(App)
  .use(signalR, { baseUrl: "https://api.example.com", accessTokenFactory: () => "token" })
  .mount("#app");

// Call this composable in a component's setup().
export function useHistoryCount(roomId: string) {
  const getHistory = signalR.useSignalRInvoke("/hubs/rooms", "GetHistory");
  const count = ref(0);
  const load = () => getHistory(roomId).then((m) => (count.value = m.length)).catch(console.error);
  return { count, load };
}

Documentation

License

MIT © DammersCode

Related Packages

@dreamonkey/vue-signalr

SignalR plugin for Vue 3

84,683 25
@quangdao/vue-signalr

SignalR plugin for Vue 3

4,484 21
@opentask/taskin-task-provider-pinia

Pinia store for task management integration with Taskin

2,224 1
vue-indiesockets

A lightweight Websocket-Plugin for vue.js including the fitting server implement...

1,545 3
@priemskiyyy/simulcast-vue

Vue bindings for simulcast: a provider component that owns the realtime session...

606 2

Version History

Version Released Vue License
1.0.0 ^3.3.0 MIT
0.5.0 >=3.3 MIT
0.4.0 >=3.3 MIT