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

@aspnet/signalr

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aspnet/signalr - npm Package Compare versions

Comparing version 3.0.0-preview-19075-0444 to 3.0.0-preview3-19153-02

dist/webworker/signalr.js

13

dist/cjs/HttpConnection.js

@@ -50,3 +50,3 @@ "use strict";

var EventSourceModule = null;
if (typeof window === "undefined" && typeof require !== "undefined") {
if (Utils_1.Platform.isNode && typeof require !== "undefined") {
// In order to ignore the dynamic require in webpack builds we need to do this magic

@@ -68,7 +68,6 @@ // @ts-ignore: TS doesn't know about these names

options.logMessageContent = options.logMessageContent || false;
var isNode = typeof window === "undefined";
if (!isNode && typeof WebSocket !== "undefined" && !options.WebSocket) {
if (!Utils_1.Platform.isNode && typeof WebSocket !== "undefined" && !options.WebSocket) {
options.WebSocket = WebSocket;
}
else if (isNode && !options.WebSocket) {
else if (Utils_1.Platform.isNode && !options.WebSocket) {
if (WebSocketModule) {

@@ -78,6 +77,6 @@ options.WebSocket = WebSocketModule;

}
if (!isNode && typeof EventSource !== "undefined" && !options.EventSource) {
if (!Utils_1.Platform.isNode && typeof EventSource !== "undefined" && !options.EventSource) {
options.EventSource = EventSource;
}
else if (isNode && !options.EventSource) {
else if (Utils_1.Platform.isNode && !options.EventSource) {
if (typeof EventSourceModule !== "undefined") {

@@ -431,3 +430,3 @@ options.EventSource = EventSourceModule;

}
if (typeof window === "undefined" || !window || !window.document) {
if (!Utils_1.Platform.isBrowser || !window.document) {
throw new Error("Cannot resolve '" + url + "'.");

@@ -434,0 +433,0 @@ }

@@ -163,2 +163,3 @@ "use strict";

var invocationDescriptor = this.createStreamInvocation(methodName, args, streamIds);
var promiseQueue;
var subject = new Subject_1.Subject();

@@ -168,3 +169,5 @@ subject.cancelCallback = function () {

delete _this.callbacks[invocationDescriptor.invocationId];
return _this.sendWithProtocol(cancelInvocation);
return promiseQueue.then(function () {
return _this.sendWithProtocol(cancelInvocation);
});
};

@@ -191,3 +194,3 @@ this.callbacks[invocationDescriptor.invocationId] = function (invocationEvent, error) {

};
var promiseQueue = this.sendWithProtocol(invocationDescriptor)
promiseQueue = this.sendWithProtocol(invocationDescriptor)
.catch(function (e) {

@@ -194,0 +197,0 @@ subject.error(e);

@@ -7,3 +7,3 @@ "use strict";

/** The version of the SignalR client. */
exports.VERSION = "3.0.0-preview-19075-0444";
exports.VERSION = "3.0.0-preview3-19153-02";
var Errors_1 = require("./Errors");

@@ -10,0 +10,0 @@ exports.AbortError = Errors_1.AbortError;

@@ -82,3 +82,3 @@ "use strict";

var eventSource;
if (typeof window !== "undefined") {
if (Utils_1.Platform.isBrowser || Utils_1.Platform.isWebWorker) {
eventSource = new _this.eventSourceConstructor(url, { withCredentials: true });

@@ -85,0 +85,0 @@ }

@@ -61,2 +61,30 @@ "use strict";

/** @private */
var Platform = /** @class */ (function () {
function Platform() {
}
Object.defineProperty(Platform, "isBrowser", {
get: function () {
return typeof window === "object";
},
enumerable: true,
configurable: true
});
Object.defineProperty(Platform, "isWebWorker", {
get: function () {
return typeof self === "object" && "importScripts" in self;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Platform, "isNode", {
get: function () {
return !this.isBrowser && !this.isWebWorker;
},
enumerable: true,
configurable: true
});
return Platform;
}());
exports.Platform = Platform;
/** @private */
function getDataDetail(data, includeContent) {

@@ -63,0 +91,0 @@ var detail = "";

@@ -77,3 +77,3 @@ "use strict";

var cookies = _this.httpClient.getCookieString(url);
if (typeof window === "undefined" && cookies) {
if (Utils_1.Platform.isNode && cookies) {
// Only pass cookies when in non-browser environments

@@ -80,0 +80,0 @@ webSocket = new _this.webSocketConstructor(url, undefined, {

@@ -43,3 +43,3 @@ // Copyright (c) .NET Foundation. All rights reserved.

import { ServerSentEventsTransport } from "./ServerSentEventsTransport";
import { Arg, createLogger } from "./Utils";
import { Arg, createLogger, Platform } from "./Utils";
import { WebSocketTransport } from "./WebSocketTransport";

@@ -49,3 +49,3 @@ var MAX_REDIRECTS = 100;

var EventSourceModule = null;
if (typeof window === "undefined" && typeof require !== "undefined") {
if (Platform.isNode && typeof require !== "undefined") {
// In order to ignore the dynamic require in webpack builds we need to do this magic

@@ -67,7 +67,6 @@ // @ts-ignore: TS doesn't know about these names

options.logMessageContent = options.logMessageContent || false;
var isNode = typeof window === "undefined";
if (!isNode && typeof WebSocket !== "undefined" && !options.WebSocket) {
if (!Platform.isNode && typeof WebSocket !== "undefined" && !options.WebSocket) {
options.WebSocket = WebSocket;
}
else if (isNode && !options.WebSocket) {
else if (Platform.isNode && !options.WebSocket) {
if (WebSocketModule) {

@@ -77,6 +76,6 @@ options.WebSocket = WebSocketModule;

}
if (!isNode && typeof EventSource !== "undefined" && !options.EventSource) {
if (!Platform.isNode && typeof EventSource !== "undefined" && !options.EventSource) {
options.EventSource = EventSource;
}
else if (isNode && !options.EventSource) {
else if (Platform.isNode && !options.EventSource) {
if (typeof EventSourceModule !== "undefined") {

@@ -430,3 +429,3 @@ options.EventSource = EventSourceModule;

}
if (typeof window === "undefined" || !window || !window.document) {
if (!Platform.isBrowser || !window.document) {
throw new Error("Cannot resolve '" + url + "'.");

@@ -433,0 +432,0 @@ }

@@ -161,2 +161,3 @@ // Copyright (c) .NET Foundation. All rights reserved.

var invocationDescriptor = this.createStreamInvocation(methodName, args, streamIds);
var promiseQueue;
var subject = new Subject();

@@ -166,3 +167,5 @@ subject.cancelCallback = function () {

delete _this.callbacks[invocationDescriptor.invocationId];
return _this.sendWithProtocol(cancelInvocation);
return promiseQueue.then(function () {
return _this.sendWithProtocol(cancelInvocation);
});
};

@@ -189,3 +192,3 @@ this.callbacks[invocationDescriptor.invocationId] = function (invocationEvent, error) {

};
var promiseQueue = this.sendWithProtocol(invocationDescriptor)
promiseQueue = this.sendWithProtocol(invocationDescriptor)
.catch(function (e) {

@@ -192,0 +195,0 @@ subject.error(e);

@@ -5,3 +5,3 @@ // Copyright (c) .NET Foundation. All rights reserved.

/** The version of the SignalR client. */
export var VERSION = "3.0.0-preview-19075-0444";
export var VERSION = "3.0.0-preview3-19153-02";
export { AbortError, HttpError, TimeoutError } from "./Errors";

@@ -8,0 +8,0 @@ export { HttpClient, HttpResponse } from "./HttpClient";

@@ -40,3 +40,3 @@ // Copyright (c) .NET Foundation. All rights reserved.

import { TransferFormat } from "./ITransport";
import { Arg, getDataDetail, sendMessage } from "./Utils";
import { Arg, getDataDetail, Platform, sendMessage } from "./Utils";
/** @private */

@@ -81,3 +81,3 @@ var ServerSentEventsTransport = /** @class */ (function () {

var eventSource;
if (typeof window !== "undefined") {
if (Platform.isBrowser || Platform.isWebWorker) {
eventSource = new _this.eventSourceConstructor(url, { withCredentials: true });

@@ -84,0 +84,0 @@ }

@@ -11,2 +11,8 @@ import { HttpClient } from "./HttpClient";

/** @private */
export declare class Platform {
static readonly isBrowser: boolean;
static readonly isWebWorker: boolean;
static readonly isNode: boolean;
}
/** @private */
export declare function getDataDetail(data: any, includeContent: boolean): string;

@@ -13,0 +19,0 @@ /** @private */

@@ -59,2 +59,30 @@ // Copyright (c) .NET Foundation. All rights reserved.

/** @private */
var Platform = /** @class */ (function () {
function Platform() {
}
Object.defineProperty(Platform, "isBrowser", {
get: function () {
return typeof window === "object";
},
enumerable: true,
configurable: true
});
Object.defineProperty(Platform, "isWebWorker", {
get: function () {
return typeof self === "object" && "importScripts" in self;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Platform, "isNode", {
get: function () {
return !this.isBrowser && !this.isWebWorker;
},
enumerable: true,
configurable: true
});
return Platform;
}());
export { Platform };
/** @private */
export function getDataDetail(data, includeContent) {

@@ -61,0 +89,0 @@ var detail = "";

@@ -40,3 +40,3 @@ // Copyright (c) .NET Foundation. All rights reserved.

import { TransferFormat } from "./ITransport";
import { Arg, getDataDetail } from "./Utils";
import { Arg, getDataDetail, Platform } from "./Utils";
/** @private */

@@ -76,3 +76,3 @@ var WebSocketTransport = /** @class */ (function () {

var cookies = _this.httpClient.getCookieString(url);
if (typeof window === "undefined" && cookies) {
if (Platform.isNode && cookies) {
// Only pass cookies when in non-browser environments

@@ -79,0 +79,0 @@ webSocket = new _this.webSocketConstructor(url, undefined, {

{
"name": "@aspnet/signalr",
"version": "3.0.0-preview-19075-0444",
"version": "3.0.0-preview3-19153-02",
"description": "ASP.NET Core SignalR Client",

@@ -15,3 +15,3 @@ "main": "./dist/cjs/index.js",

"clean": "node ../common/node_modules/rimraf/bin.js ./dist",
"build": "npm run clean && npm run build:lint && npm run build:esm && npm run build:cjs && npm run build:browser && npm run build:uglify",
"build": "npm run clean && npm run build:lint && npm run build:esm && npm run build:cjs && npm run build:browser && npm run build:webworker && npm run build:uglify",
"build:lint": "node ../common/node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json",

@@ -21,3 +21,6 @@ "build:esm": "node ../common/node_modules/typescript/bin/tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d && node ./build/process-dts.js",

"build:browser": "node ../common/node_modules/webpack-cli/bin/cli.js",
"build:uglify": "node ../common/node_modules/uglify-js/bin/uglifyjs --source-map \"url='signalr.min.js.map',content='./dist/browser/signalr.js.map'\" --comments -o ./dist/browser/signalr.min.js ./dist/browser/signalr.js",
"build:webworker": "node ../common/node_modules/webpack-cli/bin/cli.js --env.platform=webworker",
"build:uglify": "npm run build:uglify:browser && npm run build:uglify:webworker",
"build:uglify:browser": "node ../common/node_modules/uglify-js/bin/uglifyjs --source-map \"url='signalr.min.js.map',content='./dist/browser/signalr.js.map'\" --comments -o ./dist/browser/signalr.min.js ./dist/browser/signalr.js",
"build:uglify:webworker": "node ../common/node_modules/uglify-js/bin/uglifyjs --source-map \"url='signalr.min.js.map',content='./dist/webworker/signalr.js.map'\" --comments -o ./dist/webworker/signalr.min.js ./dist/webworker/signalr.js",
"prepack": "node ../build/embed-version.js",

@@ -24,0 +27,0 @@ "test": "echo \"Run 'npm test' in the 'clients\\ts' folder to test this package\" && exit 1"

@@ -17,2 +17,6 @@ JavaScript and TypeScript clients for SignalR for ASP.NET Core

### WebWorker
To use the client in a webworker, copy `*.js` files from the `dist/webworker` folder to your script folder include on your webworker using the `importScripts` function. Note that webworker SignalR hub connection supports only absolute path to a SignalR hub.
### Node.js

@@ -37,2 +41,21 @@

### Example (WebWorker)
```JavaScript
importScripts('signalr.js');
let connection = new signalR.HubConnectionBuilder()
.withUrl("https://example.com/signalr/chat")
.build();
connection.on("send", data => {
console.log(data);
});
connection.start()
.then(() => connection.invoke("send", "Hello"));
```
### Example (NodeJS)

@@ -39,0 +62,0 @@

@@ -12,3 +12,3 @@ // Copyright (c) .NET Foundation. All rights reserved.

import { ServerSentEventsTransport } from "./ServerSentEventsTransport";
import { Arg, createLogger } from "./Utils";
import { Arg, createLogger, Platform } from "./Utils";
import { WebSocketTransport } from "./WebSocketTransport";

@@ -42,3 +42,3 @@

let EventSourceModule: any = null;
if (typeof window === "undefined" && typeof require !== "undefined") {
if (Platform.isNode && typeof require !== "undefined") {
// In order to ignore the dynamic require in webpack builds we need to do this magic

@@ -76,6 +76,5 @@ // @ts-ignore: TS doesn't know about these names

const isNode = typeof window === "undefined";
if (!isNode && typeof WebSocket !== "undefined" && !options.WebSocket) {
if (!Platform.isNode && typeof WebSocket !== "undefined" && !options.WebSocket) {
options.WebSocket = WebSocket;
} else if (isNode && !options.WebSocket) {
} else if (Platform.isNode && !options.WebSocket) {
if (WebSocketModule) {

@@ -86,5 +85,5 @@ options.WebSocket = WebSocketModule;

if (!isNode && typeof EventSource !== "undefined" && !options.EventSource) {
if (!Platform.isNode && typeof EventSource !== "undefined" && !options.EventSource) {
options.EventSource = EventSource;
} else if (isNode && !options.EventSource) {
} else if (Platform.isNode && !options.EventSource) {
if (typeof EventSourceModule !== "undefined") {

@@ -390,3 +389,3 @@ options.EventSource = EventSourceModule;

if (typeof window === "undefined" || !window || !window.document) {
if (!Platform.isBrowser || !window.document) {
throw new Error(`Cannot resolve '${url}'.`);

@@ -393,0 +392,0 @@ }

@@ -159,2 +159,3 @@ // Copyright (c) .NET Foundation. All rights reserved.

let promiseQueue: Promise<void>;
const subject = new Subject<T>();

@@ -166,3 +167,5 @@ subject.cancelCallback = () => {

return this.sendWithProtocol(cancelInvocation);
return promiseQueue.then(() => {
return this.sendWithProtocol(cancelInvocation);
});
};

@@ -188,3 +191,3 @@

const promiseQueue = this.sendWithProtocol(invocationDescriptor)
promiseQueue = this.sendWithProtocol(invocationDescriptor)
.catch((e) => {

@@ -191,0 +194,0 @@ subject.error(e);

@@ -8,3 +8,3 @@ // Copyright (c) .NET Foundation. All rights reserved.

import { EventSourceConstructor } from "./Polyfills";
import { Arg, getDataDetail, sendMessage } from "./Utils";
import { Arg, getDataDetail, Platform, sendMessage } from "./Utils";

@@ -61,3 +61,3 @@ /** @private */

let eventSource: EventSource;
if (typeof window !== "undefined") {
if (Platform.isBrowser || Platform.isWebWorker) {
eventSource = new this.eventSourceConstructor(url, { withCredentials: true });

@@ -64,0 +64,0 @@ } else {

@@ -27,2 +27,18 @@ // Copyright (c) .NET Foundation. All rights reserved.

/** @private */
export class Platform {
public static get isBrowser(): boolean {
return typeof window === "object";
}
public static get isWebWorker(): boolean {
return typeof self === "object" && "importScripts" in self;
}
public static get isNode(): boolean {
return !this.isBrowser && !this.isWebWorker;
}
}
/** @private */
export function getDataDetail(data: any, includeContent: boolean): string {

@@ -29,0 +45,0 @@ let detail = "";

@@ -8,3 +8,3 @@ // Copyright (c) .NET Foundation. All rights reserved.

import { WebSocketConstructor } from "./Polyfills";
import { Arg, getDataDetail } from "./Utils";
import { Arg, getDataDetail, Platform } from "./Utils";

@@ -54,3 +54,3 @@ /** @private */

if (typeof window === "undefined" && cookies) {
if (Platform.isNode && cookies) {
// Only pass cookies when in non-browser environments

@@ -57,0 +57,0 @@ webSocket = new this.webSocketConstructor(url, undefined, {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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