Vue.js 2 plugin that provides native WebSocket integration, with optional Vuex store support for reactive state management. Latest version 2.0.15, stable but in maintenance mode (last release 2020). Key differentiator: simple API using Vue.use() with automatic reconnection, JSON formatting, and Vuex mutation-based event handling. Compared to alternatives like vue-socket.io, this uses native WebSocket (no Socket.IO dependency) and is lighter, but lacks modern features like ESM exports or Vue 3 support.
npm install vue-native-websocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to install the plugin with Vuex store integration, JSON formatting, auto-reconnection, and a send method.
Use an alternative like vue-native-websocket-vue3 or upgrade to a Vue 3 compatible plugin.
Ensure mutation names match exactly: SOCKET_ONOPEN, SOCKET_ONCLOSE, SOCKET_ONERROR, SOCKET_ONMESSAGE.
Consider using vue-native-websocket-vue3 or a modern alternative like vue-socket.io-extended.
Call this.$connect() (or vm.$connect()) explicitly after Vue.use().
Use format: 'json' in options, or access event.data in the mutation.
Use 'const VueNativeSock = require('vue-native-websocket').default' OR use ES import syntax.Ensure $connect() is called (if connectManually: true) or wait for SOCKET_ONOPEN mutation.
Verify mutation name is exactly 'SOCKET_ONMESSAGE' in the store.