fastify-wsapix
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

fastify-wsapix

npm version

WebSocket support for Fastify built on the wsapix library.

Install

npm install fastify-wsapix --save

Support TypeScript

Usage

import Fastify from 'fastify'
import fastifyWsapix from 'fastify-wsapix'

const app = Fastify({
    log: true,
})

app.register(fastifyWsapix, {
    engine: 'ws' // can be only 'ws' or 'uWS', default is 'ws'
})

app.listen(3000, err => {
    if (err) {
        app.log.error(err)
        process.exit(1)
    }
})

app.wsapix.on('connect', (client) => {
    console.log('Client connected.')
    client.send('Hellow from server!') // Creates an echo server
})

Notes

Wsapix it is next generation Websocket framework for nodejs

Provides to you:

  • Channel/message approach for websocket API
  • uWebsockets.js engine support
  • Middlewares and hooks support
  • Custom schema parser/serializer support
  • Message paylaod validation
  • AsyncAPI specification generation
  • Mock server with websocket client injection
  • Typescript syntax support out of the box

License

Licensed under MIT.

Package Sidebar

Install

npm i fastify-wsapix

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

7.09 kB

Total Files

9

Last publish

Collaborators

  • jennifer23