A Vite plugin that integrates a Socket.IO server into the Vite dev server, enabling real-time WebSocket communication during development. Version 1.0.2 is the latest stable release, updated infrequently. It wraps socket.io and attaches it to the Vite HTTP server, allowing developers to define server and socket event handlers directly in the Vite config. Differentiators: minimal configuration, automatic WebSocket injection into Vite's HMR pipeline, and support for custom socket event callbacks.
npm install vite-plugin-socket-ioVerified import paths — ran on the pinned version, not inferred.
Basic setup to add Socket.IO server to Vite dev server with no extra events.
Use a separate Socket.IO server for production, or conditionally exclude the plugin.
Use default import syntax: import vitePluginSocketIO from 'vite-plugin-socket.io'
Switch to ES modules or use dynamic import().
Run: npm install socket.io
Change to: import vitePluginSocketIO from 'vite-plugin-socket.io'
Run: npm install socket.io
Change to: import vitePluginSocketIO from 'vite-plugin-socket.io'