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

@miniflare/web-sockets

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@miniflare/web-sockets - npm Package Compare versions

Comparing version 2.0.0-next.3 to 2.0.0-rc.1

8

dist/src/index.d.ts

@@ -1,5 +0,4 @@

import { Compatibility } from '@miniflare/shared';
import { InputGatedEventTarget } from '@miniflare/shared';
import { Log } from '@miniflare/shared';
import { Plugin } from '@miniflare/shared';
import { PluginContext } from '@miniflare/shared';
import { RequestInfo as RequestInfo_2 } from '@miniflare/core';

@@ -29,2 +28,4 @@ import { RequestInit as RequestInit_2 } from '@miniflare/core';

declare const kClose: unique symbol;
declare const kClosed: unique symbol;

@@ -53,2 +54,3 @@

close(code?: number, reason?: string): void;
[kClose](code?: number, reason?: string): void;
}

@@ -75,3 +77,3 @@ export { WebSocket_2 as WebSocket }

#private;
constructor(log: Log, compat: Compatibility);
constructor(ctx: PluginContext);
setup(): SetupResult;

@@ -78,0 +80,0 @@ fetch: (input: RequestInfo_2, init?: RequestInit_2 | undefined) => Promise<Response_2>;

@@ -44,2 +44,3 @@ // packages/web-sockets/src/fetch.ts

var kClosed = Symbol("kClosed");
var kClose = Symbol("kClose");
var WebSocket = class extends InputGatedEventTarget {

@@ -87,8 +88,2 @@ #sendQueue = [];

close(code, reason) {
const pair = this[kPair];
if (!this[kAccepted]) {
throw new TypeError("You must call accept() on this WebSocket before sending messages.");
}
if (this[kClosed])
throw new TypeError("WebSocket already closed");
if (code) {

@@ -102,4 +97,12 @@ const validCode = code >= 1e3 && code < 5e3 && code !== 1004 && code !== 1005 && code !== 1006 && code !== 1015;

}
this[kClose](code, reason);
}
[kClose](code, reason) {
if (!this[kAccepted]) {
throw new TypeError("You must call accept() on this WebSocket before sending messages.");
}
if (this[kClosed])
throw new TypeError("WebSocket already closed");
this[kClosed] = true;
pair[kClosed] = true;
this[kPair][kClosed] = true;
void this.#dispatchCloseEvent(code, reason);

@@ -140,3 +143,3 @@ }

if (!pair[kClosed])
pair.close(code, reason.toString());
pair[kClose](code, reason.toString());
});

@@ -177,3 +180,2 @@ ws.on("error", (error) => {

const request = new Request(input, init);
request.headers.delete("host");
if (request.method === "GET" && request.headers.get("upgrade") === "websocket") {

@@ -213,5 +215,5 @@ const headers = {};

#upgradingFetch;
constructor(log, compat) {
super(log, compat);
this.#upgradingFetch = createCompatFetch(compat, upgradingFetch);
constructor(ctx) {
super(ctx);
this.#upgradingFetch = createCompatFetch(ctx.compat, upgradingFetch);
}

@@ -218,0 +220,0 @@ setup() {

{
"name": "@miniflare/web-sockets",
"version": "2.0.0-next.3",
"version": "2.0.0-rc.1",
"description": "WebSocket module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers",

@@ -39,4 +39,4 @@ "keywords": [

"dependencies": {
"@miniflare/core": "2.0.0-next.3",
"@miniflare/shared": "2.0.0-next.3",
"@miniflare/core": "2.0.0-rc.1",
"@miniflare/shared": "2.0.0-rc.1",
"ws": "^8.2.2",

@@ -46,5 +46,5 @@ "undici": "^4.9.3"

"devDependencies": {
"@miniflare/shared-test": "2.0.0-next.3",
"@types/ws": "^7.4.7"
"@miniflare/shared-test": "2.0.0-rc.1",
"@types/ws": "^8.2.0"
}
}

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