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.1 to 0.2.0

16

index.js

@@ -15,18 +15,2 @@ 'use strict'

const keepAlive = ws => {
ws.alive = true
const stayAlive = () => { ws.alive = true }
ws.on('pong', stayAlive)
}
wss.on('connection', keepAlive)
const pingInterval = Number.parseInt(opts.pingInterval, 10) || 30000
setInterval(() => wss.clients.forEach(ws => {
if (ws.alive === false) return ws.terminate()
ws.alive = false
ws.ping('', false, true)
}), pingInterval)
fastify.decorate('wsServer', wss)

@@ -33,0 +17,0 @@

2

package.json
{
"name": "fastify-ws",
"version": "0.1.1",
"version": "0.2.0",
"description": "Basic WebSocket support for Fastify built on the blazing fast ws and uws libraries.",

@@ -5,0 +5,0 @@ "main": "index.js",

# fastify-ws
[![Build Status](https://travis-ci.org/gj/fastify-ws.svg?branch=master)](https://travis-ci.org/gj/fastify-ws)
[![Build Status](https://travis-ci.org/gj/fastify-ws.svg?branch=master)](https://travis-ci.org/gj/fastify-ws) [![npm version](https://badge.fury.io/js/fastify-ws.svg)](https://www.npmjs.com/package/fastify-ws)

@@ -15,3 +15,2 @@ 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.

fastify.register(require('fastify-ws'), {
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

@@ -18,0 +17,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