Socket
Socket
Sign inDemoInstall

hapi-plugin-websocket

Package Overview
Dependencies
104
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.8 to 2.4.0

hapi-plugin-websocket.d.ts

18

hapi-plugin-websocket.js

@@ -135,3 +135,3 @@ /*

wss = new WS.Server({
/* the underyling HTTP server */
/* the underlying HTTP server */
server: server.listener,

@@ -242,3 +242,3 @@

if (response.statusCode >= 300) {
const annotation = `(HAPI handler reponded with HTTP status ${response.statusCode})`
const annotation = `(HAPI handler responded with HTTP status ${response.statusCode})`
if (response.statusCode < 400)

@@ -297,3 +297,3 @@ ws.close(1002, `Protocol Error ${annotation}`)

else {
/* plain WebSocket communication (uncorrelated request/reponse) */
/* plain WebSocket communication (uncorrelated request/response) */
ws.on("message", async (message) => {

@@ -377,4 +377,12 @@ /* inject incoming WebSocket message as a simulated HTTP request */

if (isRequestWebSocketDriven(request)) {
request.info.remoteAddress = request.plugins.websocket.req.socket.remoteAddress
request.info.remotePort = request.plugins.websocket.req.socket.remotePort
/* RequestInfo's remoteAddress and remotePort use getters and are not
settable, so we have to replace them. */
Object.defineProperties(request.info, {
remoteAddress: {
value: request.plugins.websocket.req.socket.remoteAddress
},
remotePort: {
value: request.plugins.websocket.req.socket.remotePort
}
})
}

@@ -381,0 +389,0 @@ return h.continue

{
"name": "hapi-plugin-websocket",
"version": "2.3.8",
"version": "2.4.0",
"description": "HAPI plugin for seamless WebSocket integration",
"keywords": [ "hapi", "plugin", "websocket" ],
"main": "./hapi-plugin-websocket.js",
"types": "./hapi-plugin-websocket.d.ts",
"license": "MIT",

@@ -24,13 +25,15 @@ "repository": {

"urijs": "1.19.11",
"@hapi/hoek": "9.2.1",
"@hapi/boom": "9.1.4",
"ws": "8.5.0",
"websocket-framed": "1.2.8"
"@hapi/hoek": "11.0.2",
"@hapi/boom": "10.0.0",
"ws": "8.12.0",
"websocket-framed": "1.2.9",
"@types/node": "18.11.18",
"@types/ws": "8.5.4"
},
"devDependencies": {
"@hapi/hapi": "20.2.2",
"@hapi/basic": "6.0.0",
"eslint": "8.13.0",
"@hapi/hapi": "21.2.0",
"@hapi/basic": "7.0.0",
"eslint": "8.32.0",
"eslint-config-standard": "17.0.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-import": "2.27.4",
"eslint-plugin-node": "11.1.0"

@@ -37,0 +40,0 @@ },

@@ -49,3 +49,3 @@

/* register Basic authentication stategy */
/* register Basic authentication strategy */
server.auth.strategy("basic", "basic", {

@@ -109,3 +109,3 @@ validate: async (request, username, password, h) => {

initially: true,
subprotocol: "quux",
subprotocol: "quux.example.com",
connect: ({ ctx, ws }) => {

@@ -215,3 +215,3 @@ ctx.to = setInterval(() => {

# access the full-featured exclusive WebSocket route via WebSockets
$ wscat --subprotocol "quux/1.0" --auth foo:bar --connect ws://127.0.0.1:12345/quux
$ wscat --subprotocol "quux.example.com" --auth foo:bar --connect ws://127.0.0.1:12345/quux
< {"cmd":"HELLO",arg:"foo"}

@@ -287,3 +287,3 @@ > {"cmd":"PING"}

autoping: 10 * 1000,
subprotocol: "foo/1.0",
subprotocol: "quux.example.com",
initially: true,

@@ -290,0 +290,0 @@ connect: ({ ctx, wss, ws, req, peers }) => {

@@ -16,3 +16,3 @@

/* register Basic authentication stategy */
/* register Basic authentication strategy */
server.auth.strategy("basic", "basic", {

@@ -76,3 +76,3 @@ validate: async (request, username, password, h) => {

initially: true,
subprotocol: "quux",
subprotocol: "quux.example.com",
connect: ({ ctx, ws }) => {

@@ -79,0 +79,0 @@ ctx.to = setInterval(() => {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc