Gathering detailed insights and metrics for vue-3-socket.io
Gathering detailed insights and metrics for vue-3-socket.io
Gathering detailed insights and metrics for vue-3-socket.io
Gathering detailed insights and metrics for vue-3-socket.io
vue-3-ts-socket.io
socket.io implementation for Vue.js version 3 and Vuex with Typescript
vue-3-socket.io-ext
socket.io implementation for Vue.js and Vuex
@kim5257/vue-socket.io-pinia
This template should help get you started developing with Vue 3 in Vite.
vue-connexion
A package providing Socket.io bindings for Vue 3 with Composition API.
npm install vue-3-socket.io
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
208,651
Last Day
149
Last Week
835
Last Month
3,645
Last Year
51,553
MIT License
42 Stars
124 Commits
23 Forks
1 Branches
1 Contributors
Updated on Jun 07, 2025
Latest Version
1.0.5
Package Id
vue-3-socket.io@1.0.5
Unpacked Size
149.92 kB
Size
70.15 kB
File Count
8
NPM Version
8.1.0
Node Version
16.14.0
Cumulative downloads
Total Downloads
Last Day
13.7%
149
Compared to previous day
Last Week
9.6%
835
Compared to previous week
Last Month
-8%
3,645
Compared to previous month
Last Year
-0.4%
51,553
Compared to previous year
Vue-3-Socket.io is a Vue 3 compatibility version of this repo
All thanks to its author
are you looking for old documentation? it's here
1npm install vue-3-socket.io --save
1import Vue from 'vue' 2import store from './store' 3import App from './App.vue' 4import VueSocketIO from 'vue-3-socket.io' 5 6Vue.use(new VueSocketIO({ 7 debug: true, 8 connection: 'http://metinseylan.com:1992', 9 vuex: { 10 store, 11 actionPrefix: 'SOCKET_', 12 mutationPrefix: 'SOCKET_' 13 }, 14 options: { path: "/my-app/" } //Optional options 15})) 16 17new Vue({ 18 router, 19 store, 20 render: h => h(App) 21}).$mount('#app')
1import Vue from 'vue' 2import store from './store' 3import App from './App.vue' 4import VueSocketIO from 'vue-3-socket.io' 5import SocketIO from 'socket.io-client' 6 7const options = { path: '/my-app/' }; //Options object to pass into SocketIO 8 9Vue.use(new VueSocketIO({ 10 debug: true, 11 connection: SocketIO('http://metinseylan.com:1992', options), //options object is Optional 12 vuex: { 13 store, 14 actionPrefix: "SOCKET_", 15 mutationPrefix: "SOCKET_" 16 } 17 }) 18); 19 20new Vue({ 21 router, 22 store, 23 render: h => h(App) 24}).$mount('#app')
Parameters | Type's | Default | Required | Description |
---|---|---|---|---|
debug | Boolean | false | Optional | Enable logging for debug |
connection | String/Socket.io-client | null | Required | Websocket server url or socket.io-client instance |
vuex.store | Vuex | null | Optional | Vuex store instance |
vuex.actionPrefix | String | null | Optional | Prefix for emitting server side vuex actions |
vuex.mutationPrefix | String | null | Optional | Prefix for emitting server side vuex mutations |
If you want to listen socket events from component side, you need to add `sockets` object in Vue component, and every function will start to listen events, depends on object key
1new Vue({ 2 sockets: { 3 connect: function () { 4 console.log('socket connected') 5 }, 6 customEmit: function (data) { 7 console.log('this method was fired by the socket server. eg: io.emit("customEmit", data)') 8 } 9 }, 10 methods: { 11 clickButton: function (data) { 12 // $socket is socket.io-client instance 13 this.$socket.emit('emit_method', data) 14 } 15 } 16})
If you need consuming events dynamically in runtime, you can use `subscribe` and `unsubscribe` methods in Vue component
1this.sockets.subscribe('EVENT_NAME', (data) => { 2 this.msg = data.message; 3}); 4 5this.sockets.unsubscribe('EVENT_NAME');
If you want to handle 'kebab-case', or "event with space inside it" events, then you have to define it via the following way
1export default { 2 name: 'Test', 3 sockets: { 4 connect: function () { 5 console.log('socket to notification channel connected') 6 }, 7 }, 8 9 data () { 10 return { 11 something: [ 12 // ... something here for the data if you need. 13 ] 14 } 15 }, 16 17 mounted () { 18 this.$socket.subscribe("kebab-case", function(data) { 19 console.log("This event was fired by eg. sio.emit('kebab-case')", data) 20 }) 21 } 22}
When you set store parameter in installation, `Vue-Socket.io` will start sending events to Vuex store. If you set both prefix for vuex, you can use `actions` and `mutations` at the same time. But, best way to use is just `actions`
1import Vue from 'vue' 2import Vuex from 'vuex' 3 4Vue.use(Vuex) 5 6export default new Vuex.Store({ 7 state: {}, 8 mutations: { 9 "<MUTATION_PREFIX><EVENT_NAME>"() { 10 // do something 11 } 12 }, 13 actions: { 14 "<ACTION_PREFIX><EVENT_NAME>"() { 15 // do something 16 } 17 } 18})
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 3/27 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More