1.0.0 • Published 8 years ago
@drupe/client-hmr-socket-io v1.0.0
Hot Module Replacement With Socket.IO
Update events are passed from the factory to the development server process and then to the client using socket.io. This plugin uses namespaced process and socket.io messages so it does not collide with other code.
Installation
npm i @drupe/client-hmr-socket-ioFactory Configuration
const ClientHmr = require('@drupe/client-hmr-socket-io')
plugins: [
new ClientHmr({
server: 'server',
client: 'client'
})
]- server
<string>- The name of the server component, your socket.io server is running in. - client
<string>- The name of the client component for which hot module replacement should be enabled in development mode. The hmr client will be prepended to all client entries.
Server Integration
if (process.env.NODE_ENV === 'development') {
// Forward process update messages to all clients:
require('@drupe/client-hmr-socket-io/emitter')(io)
}- io
<socketIO.Server>- Your socket io server instance.
1.0.0
8 years ago