fastify-ws
Advanced tools
Comparing version 0.4.1 to 0.5.0
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9
82
61
116415
+ Addedfastify-plugin@1.6.1(transitive)
+ Addedsemver@6.3.1(transitive)
+ Addedutf-8-validate@4.0.2(transitive)
+ Addeduws@10.148.2(transitive)
+ Addedws@5.2.4(transitive)
- Removedfastify-plugin@0.1.1(transitive)
- Removednan@2.7.0(transitive)
- Removedprebuild-install@2.3.0(transitive)
- Removedsimple-get@1.4.3(transitive)
- Removedultron@1.1.1(transitive)
- Removedunzip-response@1.0.2(transitive)
- Removedutf-8-validate@3.0.4(transitive)
- Removeduws@8.14.1(transitive)
- Removedws@3.3.3(transitive)
- Removedxtend@4.0.1(transitive)
Updatedbufferutil@^3.0.5
Updatedfastify-plugin@^1.0.1
Updatedutf-8-validate@^4.0.2
Updateduws@^10.148.0
Updatedws@^5.1.1