vue-simple-websocket v1.0.0 is a lightweight Vue.js plugin that provides a native reconnecting WebSocket client. It integrates seamlessly with Vue 3 using the plugin system, exposing a `$socketClient` global property with event handlers for open, message, close, and error events. Key differentiators include automatic reconnection with configurable intervals and a convenience `sendObj` method for sending JavaScript objects. The package is actively maintained but noted as still maturing; it has separate documentation for Vue 2.x support. Alternative solutions include Vue Socket.io and vue-native-websocket.
npm install vue-simple-websocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows plugin installation with app.use, and component usage with event handlers and sendObj method.
Use app.use() in Vue 3, or follow the Vue 2.x documentation.
Pin to exact version and monitor releases.
If you need multiple handlers, chain calls inside a single handler or use an event bus.
Ensure the runtime supports the WebSocket API (browsers, Node.js 18+ with --experimental-websocket, or polyfill).
Ensure app.use(VueSimpleWebsocket, ...) is called before mounting the app, and access $socketClient inside created/mounted hook.
Use default import: import VueSimpleWebsocket from 'vue-simple-websocket'
Pass the WebSocket URL as second argument: app.use(VueSimpleWebsocket, 'wss://example.com')
No dependency data recorded yet.