Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastify-ws

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-ws - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

8

index.js

@@ -6,3 +6,7 @@ 'use strict'

module.exports = fp((fastify, opts, next) => {
const WebSocketServer = require('ws').Server
const wsLib = opts.wsLibrary || 'ws'
if (wsLib !== 'ws' && wsLib !== 'uws') return next(new Error('Invalid "wsLibrary" option'))
const WebSocketServer = require(wsLib).Server
const wss = new WebSocketServer({

@@ -20,3 +24,3 @@ server: fastify.server

const pingInterval = opts.pingInterval || 30000
const pingInterval = Number.parseInt(opts.pingInterval, 10) || 30000

@@ -23,0 +27,0 @@ setInterval(() => wss.clients.forEach(ws => {

{
"name": "fastify-ws",
"version": "0.1.0",
"description": "Basic WebSocket support for Fastify built on the blazing fast ws library.",
"version": "0.1.1",
"description": "Basic WebSocket support for Fastify built on the blazing fast ws and uws libraries.",
"main": "index.js",

@@ -35,4 +35,5 @@ "scripts": {

"utf-8-validate": "^3.0.3",
"uws": "^8.14.1",
"ws": "^3.2.0"
}
}

@@ -5,3 +5,3 @@ # fastify-ws

WebSocket support for [Fastify](https://github.com/fastify/fastify) built on the blazing fast [ws](http://npm.im/websocket-stream) library.
WebSocket support for [Fastify](https://github.com/fastify/fastify) built on the blazing fast [ws](http://npm.im/ws) and [uws](http://npm.im/uws) libraries.

@@ -16,3 +16,4 @@ ## Example

fastify.register(require('fastify-ws'), {
pingInterval: 10000 // Keep the connection alive by sending ping every 10 seconds (default: 30 seconds)
pingInterval: 10000, // Keep the connection alive by sending pings every 10 seconds (default: 30 seconds)
wsLibrary: 'uws' // Use the uws library instead of the default ws library
})

@@ -46,2 +47,5 @@

## Notes
If you choose to use `uws` as your WebSocket library, ensure that you have configured your system properly and understand that the API is a slightly reduced subset of `ws`'s.
## TODO

@@ -48,0 +52,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc