Wondering what’s next for npm?Check out our public roadmap! »

@remixproject/plugin-wsTypeScript icon, indicating that this package has built-in type declarations

0.3.3 • Public • Published

Plugin ws

This library is a connector that connects a node server to using the ws library to the engine.

If you do not expose any API you can create an instance like this :

const wss = new WebSocket.Server({ port: 8080 });
wss.on('connection', (ws) => {
  const client = createClient(ws)
})

If you need to expose an API to other plugin you need to extends the class:

class MyPlugin extends PluginClient {
 methods = ['hello']
 hello() {
  console.log('Hello World')
 }
}
const wss = new WebSocket.Server({ port: 8080 });
wss.on('connection', (ws) => {
 const client = createClient(ws, new MyPlugin())
})

Keywords

none

Install

npm i @remixproject/[email protected]

Version

0.3.3

License

MIT

Unpacked Size

5.82 kB

Total Files

8

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar