Socket
Socket
Sign inDemoInstall

socket.io-adapter

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

socket.io-adapter - npm Package Compare versions

Comparing version 2.5.0 to 2.5.1

10

dist/index.js
"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -6,3 +7,4 @@ exports.SessionAwareAdapter = exports.Adapter = void 0;

const yeast_1 = require("./contrib/yeast");
const ws_1 = require("ws");
const WebSocket = require("ws");
const canPreComputeFrame = typeof ((_a = WebSocket === null || WebSocket === void 0 ? void 0 : WebSocket.Sender) === null || _a === void 0 ? void 0 : _a.frame) === "function";
class Adapter extends events_1.EventEmitter {

@@ -167,7 +169,9 @@ /**

const encodedPackets = this.encoder.encode(packet);
if (encodedPackets.length === 1 && typeof encodedPackets[0] === "string") {
if (canPreComputeFrame &&
encodedPackets.length === 1 &&
typeof encodedPackets[0] === "string") {
// "4" being the "message" packet type in the Engine.IO protocol
const data = Buffer.from("4" + encodedPackets[0]);
// see https://github.com/websockets/ws/issues/617#issuecomment-283002469
packetOpts.wsPreEncodedFrame = ws_1.WebSocket.Sender.frame(data, {
packetOpts.wsPreEncodedFrame = WebSocket.Sender.frame(data, {
readOnly: false,

@@ -174,0 +178,0 @@ mask: false,

{
"name": "socket.io-adapter",
"version": "2.5.0",
"version": "2.5.1",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": {

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