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

0.3.38 • 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())
})

Readme

Keywords

none

Package Sidebar

Install

npm i @remixproject/plugin-ws

Weekly Downloads

27,995

Version

0.3.38

License

MIT

Unpacked Size

7.58 kB

Total Files

8

Last publish

Collaborators

  • grandschtroumpf
  • yann300
  • lianahus
  • aniket-engg
  • bunsenstraat
  • ioedeveloper