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

koa-websocket

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-websocket - npm Package Compare versions

Comparing version 6.0.0 to 7.0.0

.github/dependabot.yml

1

examples/simple.js

@@ -21,3 +21,2 @@ const koa = require('koa');

app.listen(3000);
{
"name": "koa-websocket",
"version": "6.0.0",
"version": "7.0.0",
"description": "Light wrapper around Koa providing a websocket middleware handler that is koa-route compatible.",

@@ -28,17 +28,17 @@ "main": "index.js",

"dependencies": {
"co": "^4.4.0",
"debug": "^4.0.1",
"co": "^4.6.0",
"debug": "^4.3.4",
"koa-compose": "^4.1.0",
"ws": "^7.0.1"
"ws": "^8.5.0"
},
"devDependencies": {
"eslint": "^6.0.1",
"eslint-config-airbnb": "^17.1.1",
"eslint-plugin-import": "^2.18.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.2",
"koa": "^2.5.3",
"eslint": "^8.13.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.29.4",
"koa": "^2.13.4",
"koa-route": "^3.2.0",
"mocha": "^6.1.4"
"mocha": "^9.2.2"
}
}
# koa-websocket
[![Circle CI](https://circleci.com/gh/kudos/koa-websocket.svg?style=svg)](https://circleci.com/gh/kudos/koa-websocket)
[![CI Status](https://github.com/kudos/koa-websocket/actions/workflows/node.js.yml/badge.svg)](https://github.com/kudos/koa-websocket/actions)

@@ -5,0 +5,0 @@ > Koa v2 is now the default. For Koa v1 support install with koa-websocket@2 and see the `legacy` branch.

@@ -14,3 +14,3 @@ const assert = require('assert');

ctx.websocket.on('message', (message) => {
if (message === '123') {
if (message.toString() === '123') {
ctx.websocket.send(message);

@@ -28,8 +28,2 @@ }

app.ws.use(route.all('/abc', (ctx) => {
ctx.websocket.on('message', (message) => {
ctx.websocket.send(message);
});
}));
app.ws.use(route.all('/def', (ctx) => {

@@ -56,4 +50,4 @@ ctx.websocket.on('message', (message) => {

});
ws.on('message', (message) => {
assert(message === '123');
ws.on('message', (data) => {
assert(data.toString() === '123');
done();

@@ -69,4 +63,4 @@ ws.close();

});
ws.on('message', (message) => {
assert(message === 'abc');
ws.on('message', (data) => {
assert(data.toString() === 'abc');
done();

@@ -82,4 +76,4 @@ ws.close();

});
ws.on('message', (message) => {
assert(message === 'def');
ws.on('message', (data) => {
assert(data.toString() === 'def');
done();

@@ -95,4 +89,4 @@ ws.close();

});
ws.on('message', (message) => {
assert(message === 'abc');
ws.on('message', (data) => {
assert(data.toString() === 'abc');
done();

@@ -107,3 +101,3 @@ ws.close();

handleProtocols(protocols) {
if (protocols.indexOf('bad_protocol') !== -1) { return false; }
if (protocols.has('bad_protocol')) { return false; }
return protocols.pop();

@@ -110,0 +104,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