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.4.1 to 0.5.0

example/server.js

14

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

@@ -27,3 +27,3 @@ "main": "index.js",

"eslint": "^4.17.0",
"fastify": "^0.30.2",
"fastify": "^1.4.0",
"pre-commit": "^1.2.2",

@@ -35,8 +35,8 @@ "snazzy": "^7.0.0",

"dependencies": {
"bufferutil": "^3.0.2",
"fastify-plugin": "^0.1.1",
"utf-8-validate": "^3.0.3",
"uws": "^8.14.1",
"ws": "^3.2.0"
"bufferutil": "^3.0.5",
"fastify-plugin": "^1.0.1",
"utf-8-validate": "^4.0.2",
"uws": "^10.148.0",
"ws": "^5.1.1"
}
}

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

## Example
In `server.js`:
```js

@@ -22,5 +24,11 @@ 'use strict'

console.log('Server started.')
fastify.ws
.on('connection', socket => {
console.log('Client connected.')
socket.on('message', msg => socket.send(msg)) // Creates an echo server
socket.on('close', () => console.log('Client disconnected.'))
})

@@ -33,2 +41,3 @@ })

Then run `node server.js` and navigate to `http://localhost:34567` in your browser. In the browser's JavaScript console, open a client-side WebSocket connection:
```js

@@ -41,2 +50,3 @@ const host = location.origin.replace(/^http/, 'ws')

Then, still in the browser console, send some messages to the server and watch as they're echoed back to you:
```js

@@ -49,5 +59,7 @@ ws.send('WebSockets are awesome!')

## 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.
## License
Licensed under [MIT](./LICENSE).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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