├── signalr
├── dist
│ ├── esm
│ │ ├── LongPollingTransport.d.ts
│ │ ├── ServerSentEventsTransport.d.ts
│ │ ├── browser-index.d.ts
│ │ ├── Stream.js
│ │ ├── Polyfills.js
│ │ ├── IConnection.js
│ │ ├── IRetryPolicy.js
│ │ ├── IHttpConnectionOptions.js
│ │ ├── EmptyNodeHttpClient.d.ts
│ │ ├── TextMessageFormat.d.ts
│ │ ├── DefaultReconnectPolicy.d.ts
│ │ ├── Subject.d.ts
│ │ ├── WeChatHttpClient.d.ts
│ │ ├── Loggers.d.ts
│ │ ├── IConnection.d.ts
│ │ ├── Polyfills.d.ts
│ │ ├── HandshakeProtocol.d.ts
│ │ ├── AbortController.d.ts
│ │ ├── DefaultHttpClient.d.ts
│ │ ├── Loggers.js
│ │ ├── IConnection.js.map
│ │ ├── Polyfills.js.map
│ │ ├── WeChatWebSocketTransport.d.ts
│ │ ├── index.js
│ │ ├── Loggers.js.map
│ │ ├── IRetryPolicy.d.ts
│ │ ├── TextMessageFormat.js
│ │ ├── ITransport.d.ts
│ │ ├── Errors.d.ts
│ │ ├── index.d.ts
│ │ ├── DefaultReconnectPolicy.js
│ │ ├── EmptyNodeHttpClient.js.map
│ │ ├── IRetryPolicy.js.map
│ │ ├── ILogger.d.ts
│ │ ├── JsonHubProtocol.d.ts
│ │ ├── DefaultReconnectPolicy.js.map
│ │ ├── AbortController.js
│ │ ├── ITransport.js
│ │ ├── Subject.js
│ │ ├── browser-index.js
│ │ ├── ILogger.js
│ │ ├── TextMessageFormat.js.map
│ │ ├── EmptyNodeHttpClient.js
│ │ ├── IHubProtocol.js
│ │ ├── ITransport.js.map
│ │ ├── AbortController.js.map
│ │ ├── Utils.d.ts
│ │ ├── IHttpConnectionOptions.d.ts
│ │ ├── ILogger.js.map
│ │ ├── Stream.d.ts
│ │ ├── HttpClient.js
│ │ ├── index.js.map
│ │ ├── Subject.js.map
│ │ ├── browser-index.js.map
│ │ └── HttpConnection.d.ts
│ └── cjs
│ │ ├── Stream.js
│ │ ├── Polyfills.js
│ │ ├── IConnection.js
│ │ ├── IRetryPolicy.js
│ │ ├── IHttpConnectionOptions.js
│ │ ├── Loggers.js
│ │ ├── IConnection.js.map
│ │ ├── Polyfills.js.map
│ │ ├── Loggers.js.map
│ │ ├── TextMessageFormat.js
│ │ ├── EmptyNodeHttpClient.js.map
│ │ ├── IRetryPolicy.js.map
│ │ ├── DefaultReconnectPolicy.js
│ │ ├── DefaultReconnectPolicy.js.map
│ │ ├── AbortController.js
│ │ ├── Subject.js
│ │ ├── TextMessageFormat.js.map
│ │ ├── ITransport.js
│ │ ├── ILogger.js
│ │ ├── browser-index.js
│ │ ├── EmptyNodeHttpClient.js
│ │ ├── IHubProtocol.js
│ │ ├── index.js
│ │ ├── ITransport.js.map
│ │ ├── AbortController.js.map
│ │ ├── ILogger.js.map
│ │ ├── index.js.map
│ │ ├── HttpClient.js
│ │ ├── Subject.js.map
│ │ └── browser-index.js.map
├── tests
│ ├── tsconfig.json
│ ├── TestTransport.ts
│ ├── AbortSignal.test.ts
│ ├── TextMessageFormat.test.ts
│ └── Common.ts
├── src
│ ├── profill.d.ts
│ ├── Loggers.ts
│ ├── IConnection.ts
│ ├── Polyfills.ts
│ ├── EmptyNodeHttpClient.ts
│ ├── DefaultReconnectPolicy.ts
│ ├── TextMessageFormat.ts
│ ├── IRetryPolicy.ts
│ ├── AbortController.ts
│ ├── ITransport.ts
│ ├── Subject.ts
│ ├── browser-index.ts
│ ├── index.ts
│ ├── ILogger.ts
│ ├── third-party-notices.txt
│ ├── DefaultHttpClient.ts
│ ├── Errors.ts
│ └── IHttpConnectionOptions.ts
├── rollup.config.js
├── build
│ └── process-dts.js
├── tsconfig.json
├── webpack.config.js
├── signalr.npmproj
└── README.md
├── wx-demo
├── miniprogram
│ ├── pages
│ │ ├── index
│ │ │ ├── index.json
│ │ │ ├── index.wxml
│ │ │ ├── index.wxss
│ │ │ └── index.ts
│ │ └── logs
│ │ │ ├── logs.json
│ │ │ ├── logs.wxss
│ │ │ ├── logs.wxml
│ │ │ ├── logs.ts
│ │ │ └── logs.js
│ ├── sitemap.json
│ ├── app.wxss
│ ├── app.json
│ ├── package.json
│ ├── utils
│ │ └── util.ts
│ └── app.ts
├── package.json
├── yarn.lock
├── project.config.json
└── tsconfig.json
├── signalr-protocol-msgpack
├── dist
│ ├── esm
│ │ ├── browser-index.d.ts
│ │ ├── Utils.d.ts
│ │ ├── BinaryMessageFormat.d.ts
│ │ ├── index.d.ts
│ │ ├── browser-index.js
│ │ ├── index.js
│ │ ├── browser-index.js.map
│ │ ├── Utils.js
│ │ ├── index.js.map
│ │ ├── Utils.js.map
│ │ └── MessagePackHubProtocol.d.ts
│ └── cjs
│ │ ├── browser-index.js.map
│ │ ├── browser-index.js
│ │ ├── index.js
│ │ ├── index.js.map
│ │ ├── Utils.js
│ │ └── Utils.js.map
├── tests
│ └── tsconfig.json
├── tsconfig.json
├── src
│ ├── browser-index.ts
│ ├── index.ts
│ └── Utils.ts
├── rollup.config.js
├── webpack.config.js
├── signalr-protocol-msgpack.npmproj
├── README.md
└── package.json
├── FunctionalTests
├── .gitignore
├── scripts
│ ├── tsconfig.json
│ └── karma.base.conf.js
├── tsconfig.json
├── tsconfig.jest.json
├── UncreatableHub.cs
├── ts
│ ├── index.ts
│ ├── Utils.ts
│ ├── LogBannerReporter.ts
│ ├── WebSocketTests.ts
│ └── TestLogger.ts
├── ComplexObject.cs
├── AuthorizedHub.cs
├── web.config
├── EchoConnectionHandler.cs
├── webpack.config.js
├── func.jest.config.js
├── wwwroot
│ └── default.html
├── package.json
└── SignalR.Client.FunctionalTestApp.csproj
├── yarn.lock
├── EchoServer
├── EchoServer.csproj
├── appsettings.Development.json
├── appsettings.json
├── Hubs
│ ├── IEchoClient.cs
│ └── EchoHub.cs
├── Properties
│ └── launchSettings.json
├── Program.cs
└── Startup.cs
├── tsconfig.jest.json
├── common
├── common.npmproj
└── package.json
├── tslint.json
├── client-ts.npmproj
├── package.json
├── README.md
├── tsconfig.base.json
├── jest.config.js
└── .vscode
└── launch.json
/signalr/dist/esm/LongPollingTransport.d.ts:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/signalr/dist/esm/ServerSentEventsTransport.d.ts:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/wx-demo/miniprogram/pages/index/index.json:
--------------------------------------------------------------------------------
1 | {
2 | "usingComponents": {}
3 | }
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/esm/browser-index.d.ts:
--------------------------------------------------------------------------------
1 | export * from "./index";
2 |
--------------------------------------------------------------------------------
/FunctionalTests/.gitignore:
--------------------------------------------------------------------------------
1 | wwwroot/lib/
2 |
3 | # Sauce Connect proxy logs.
4 | sc-*.log
--------------------------------------------------------------------------------
/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 |
--------------------------------------------------------------------------------
/signalr/dist/esm/browser-index.d.ts:
--------------------------------------------------------------------------------
1 | import "es6-promise/dist/es6-promise.auto.js";
2 | export * from "./index";
3 |
--------------------------------------------------------------------------------
/wx-demo/miniprogram/pages/logs/logs.json:
--------------------------------------------------------------------------------
1 | {
2 | "navigationBarTitleText": "查看启动日志",
3 | "usingComponents": {}
4 | }
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/esm/Utils.d.ts:
--------------------------------------------------------------------------------
1 | /** @private */
2 | export declare function isArrayBuffer(val: any): val is ArrayBuffer;
3 |
--------------------------------------------------------------------------------
/signalr/tests/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": [
4 | "./**/*"
5 | ]
6 | }
7 |
--------------------------------------------------------------------------------
/FunctionalTests/scripts/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "commonjs",
4 | "target": "es2015"
5 | }
6 | }
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/tests/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.base.json",
3 | "include": [
4 | "./**/*"
5 | ]
6 | }
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.base.json",
3 | "include": [
4 | "./src/**/*"
5 | ]
6 | }
7 |
8 |
--------------------------------------------------------------------------------
/wx-demo/miniprogram/pages/logs/logs.wxss:
--------------------------------------------------------------------------------
1 | .log-list {
2 | display: flex;
3 | flex-direction: column;
4 | padding: 40rpx;
5 | }
6 | .log-item {
7 | margin: 10rpx;
8 | }
9 |
--------------------------------------------------------------------------------
/wx-demo/miniprogram/pages/index/index.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 | MESSAGES:
4 | {{item}}
5 |
--------------------------------------------------------------------------------
/signalr/src/profill.d.ts:
--------------------------------------------------------------------------------
1 | declare let window:any;
2 | declare type XMLHttpRequestResponseType = any;
3 | declare let self : any;
4 | declare type Buffer = any;
5 | declare let Buffer : Buffer;
--------------------------------------------------------------------------------
/EchoServer/EchoServer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/wx-demo/miniprogram/sitemap.json:
--------------------------------------------------------------------------------
1 | {
2 | "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
3 | "rules": [{
4 | "action": "allow",
5 | "page": "*"
6 | }]
7 | }
--------------------------------------------------------------------------------
/EchoServer/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Debug",
5 | "System": "Information",
6 | "Microsoft": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/esm/BinaryMessageFormat.d.ts:
--------------------------------------------------------------------------------
1 | export declare class BinaryMessageFormat {
2 | static write(output: Uint8Array): ArrayBuffer;
3 | static parse(input: ArrayBuffer): Uint8Array[];
4 | }
5 |
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/esm/index.d.ts:
--------------------------------------------------------------------------------
1 | /** The version of the SignalR Message Pack protocol library. */
2 | export declare const VERSION = "0.0.0-DEV_BUILD";
3 | export { MessagePackHubProtocol } from "./MessagePackHubProtocol";
4 |
--------------------------------------------------------------------------------
/signalr/dist/esm/Stream.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | //# sourceMappingURL=Stream.js.map
--------------------------------------------------------------------------------
/wx-demo/miniprogram/pages/logs/logs.wxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{index + 1}}. {{log}}
5 |
6 |
7 |
--------------------------------------------------------------------------------
/signalr/dist/esm/Polyfills.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | //# sourceMappingURL=Polyfills.js.map
--------------------------------------------------------------------------------
/signalr/dist/esm/IConnection.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | //# sourceMappingURL=IConnection.js.map
--------------------------------------------------------------------------------
/signalr/dist/esm/IRetryPolicy.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | //# sourceMappingURL=IRetryPolicy.js.map
--------------------------------------------------------------------------------
/EchoServer/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*"
10 | }
11 |
--------------------------------------------------------------------------------
/signalr/dist/esm/IHttpConnectionOptions.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | //# sourceMappingURL=IHttpConnectionOptions.js.map
--------------------------------------------------------------------------------
/FunctionalTests/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.base.json",
3 | "compilerOptions": {
4 | "outDir": "./obj/js",
5 | "typeRoots": [
6 | "./node_modules/@types/"
7 | ]
8 | },
9 | "include": [
10 | "./ts/**/*"
11 | ]
12 | }
--------------------------------------------------------------------------------
/wx-demo/miniprogram/app.wxss:
--------------------------------------------------------------------------------
1 | /**app.wxss**/
2 | .container {
3 | height: 100%;
4 | display: flex;
5 | flex-direction: column;
6 | align-items: center;
7 | justify-content: space-between;
8 | padding: 200rpx 0;
9 | box-sizing: border-box;
10 | }
11 |
--------------------------------------------------------------------------------
/signalr/dist/esm/EmptyNodeHttpClient.d.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient, HttpResponse } from "./HttpClient";
2 | import { ILogger } from "./ILogger";
3 | export declare class NodeHttpClient extends HttpClient {
4 | constructor(logger: ILogger);
5 | send(): Promise;
6 | }
7 |
--------------------------------------------------------------------------------
/signalr/dist/esm/TextMessageFormat.d.ts:
--------------------------------------------------------------------------------
1 | /** @private */
2 | export declare class TextMessageFormat {
3 | static RecordSeparatorCode: number;
4 | static RecordSeparator: string;
5 | static write(output: string): string;
6 | static parse(input: string): string[];
7 | }
8 |
--------------------------------------------------------------------------------
/signalr/rollup.config.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | import baseConfig from "../rollup-base"
5 |
6 | export default baseConfig(__dirname);
--------------------------------------------------------------------------------
/EchoServer/Hubs/IEchoClient.cs:
--------------------------------------------------------------------------------
1 |
2 | using System.Threading.Tasks;
3 |
4 | namespace EchoServer.Hubs
5 | {
6 |
7 | public interface IEchoClient
8 | {
9 | ///
10 | /// ping the client
11 | ///
12 | Task Ping(string ping);
13 | }
14 | }
--------------------------------------------------------------------------------
/signalr/dist/cjs/Stream.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | Object.defineProperty(exports, "__esModule", { value: true });
5 | //# sourceMappingURL=Stream.js.map
--------------------------------------------------------------------------------
/signalr/dist/cjs/Polyfills.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | Object.defineProperty(exports, "__esModule", { value: true });
5 | //# sourceMappingURL=Polyfills.js.map
--------------------------------------------------------------------------------
/signalr/dist/cjs/IConnection.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | Object.defineProperty(exports, "__esModule", { value: true });
5 | //# sourceMappingURL=IConnection.js.map
--------------------------------------------------------------------------------
/signalr/dist/cjs/IRetryPolicy.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | Object.defineProperty(exports, "__esModule", { value: true });
5 | //# sourceMappingURL=IRetryPolicy.js.map
--------------------------------------------------------------------------------
/signalr/build/process-dts.js:
--------------------------------------------------------------------------------
1 | // Edit the index.d.ts file to add the UMD export
2 | const fs = require('fs');
3 | const path = require('path');
4 |
5 | const target = path.resolve(__dirname, "..", "dist", "esm", "index.d.ts");
6 |
7 | let content = fs.readFileSync(target);
8 | fs.writeFileSync(target, content + "\r\nexport as namespace signalR;");
--------------------------------------------------------------------------------
/signalr/dist/cjs/IHttpConnectionOptions.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | Object.defineProperty(exports, "__esModule", { value: true });
5 | //# sourceMappingURL=IHttpConnectionOptions.js.map
--------------------------------------------------------------------------------
/FunctionalTests/tsconfig.jest.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.base.json",
3 | "compilerOptions": {
4 | "module": "commonjs",
5 | "noUnusedLocals": false,
6 | "noUnusedParameters": false,
7 | "typeRoots": [
8 | "./node_modules/@types"
9 | ],
10 | "allowJs": true
11 | },
12 | }
13 |
--------------------------------------------------------------------------------
/signalr/dist/esm/DefaultReconnectPolicy.d.ts:
--------------------------------------------------------------------------------
1 | import { IRetryPolicy, RetryContext } from "./IRetryPolicy";
2 | /** @private */
3 | export declare class DefaultReconnectPolicy implements IRetryPolicy {
4 | private readonly retryDelays;
5 | constructor(retryDelays?: number[]);
6 | nextRetryDelayInMilliseconds(retryContext: RetryContext): number | null;
7 | }
8 |
--------------------------------------------------------------------------------
/wx-demo/miniprogram/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | "pages/index/index",
4 | "pages/logs/logs"
5 | ],
6 | "window": {
7 | "backgroundTextStyle": "light",
8 | "navigationBarBackgroundColor": "#fff",
9 | "navigationBarTitleText": "WeChat",
10 | "navigationBarTextStyle": "black"
11 | },
12 | "sitemapLocation": "sitemap.json"
13 | }
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/src/browser-index.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | // This is where we add any polyfills we'll need for the browser. It is the entry module for browser-specific builds.
5 |
6 | export * from "./index";
7 |
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/rollup.config.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | import baseConfig from "../rollup-base"
5 |
6 | export default baseConfig(__dirname, {
7 | msgpack5: "msgpack5",
8 | "@microsoft/signalr": "signalR",
9 | });
--------------------------------------------------------------------------------
/wx-demo/miniprogram/pages/logs/logs.ts:
--------------------------------------------------------------------------------
1 | //logs.js
2 | import { formatTime } from '../../utils/util'
3 |
4 | Page({
5 | data: {
6 | logs: [] as string[]
7 | },
8 | onLoad() {
9 | this.setData!({
10 | logs: (wx.getStorageSync('logs') || []).map((log: number) => {
11 | return formatTime(new Date(log))
12 | })
13 | })
14 | },
15 | })
16 |
--------------------------------------------------------------------------------
/wx-demo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "demo",
3 | "version": "1.0.1",
4 | "scripts": {
5 | "compile": "./node_modules/typescript/bin/tsc",
6 | "tsc": "node ./node_modules/typescript/lib/tsc.js",
7 | "restore": "cd ./miniprogram && yarn"
8 | },
9 | "devDependencies": {
10 | "miniprogram-api-typings": "^2.8.3",
11 | "typescript": "^3.3.3333"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/wx-demo/miniprogram/pages/index/index.wxss:
--------------------------------------------------------------------------------
1 | /**index.wxss**/
2 | .userinfo {
3 | display: flex;
4 | flex-direction: column;
5 | align-items: center;
6 | }
7 |
8 | .userinfo-avatar {
9 | width: 128rpx;
10 | height: 128rpx;
11 | margin: 20rpx;
12 | border-radius: 50%;
13 | }
14 |
15 | .userinfo-nickname {
16 | color: #aaa;
17 | }
18 |
19 | .usermotto {
20 | margin-top: 200px;
21 | }
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/esm/browser-index.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | // This is where we add any polyfills we'll need for the browser. It is the entry module for browser-specific builds.
4 | export * from "./index";
5 | //# sourceMappingURL=browser-index.js.map
--------------------------------------------------------------------------------
/tsconfig.jest.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.base.json",
3 | "compilerOptions": {
4 | "module": "commonjs",
5 | "noUnusedLocals": false,
6 | "noUnusedParameters": false,
7 | "typeRoots": [
8 | "./common/node_modules/@types"
9 | ],
10 | "allowJs": true
11 | },
12 | "include": [
13 | "./*/tests/**/*"
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/signalr/dist/esm/Subject.d.ts:
--------------------------------------------------------------------------------
1 | import { IStreamResult, IStreamSubscriber, ISubscription } from "./Stream";
2 | /** Stream implementation to stream items to the server. */
3 | export declare class Subject implements IStreamResult {
4 | constructor();
5 | next(item: T): void;
6 | error(err: any): void;
7 | complete(): void;
8 | subscribe(observer: IStreamSubscriber): ISubscription;
9 | }
10 |
--------------------------------------------------------------------------------
/wx-demo/miniprogram/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "demo",
3 | "version": "1.0.1",
4 | "scripts": {
5 | "compile": "./node_modules/typescript/bin/tsc",
6 | "tsc": "node ./node_modules/typescript/lib/tsc.js"
7 | },
8 | "devDependencies": {
9 | "typescript": "^3.3.3333"
10 | },
11 | "dependencies": {
12 | "wechat-app-signalr":"link:../../signalr"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/FunctionalTests/UncreatableHub.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using Microsoft.AspNetCore.SignalR;
5 |
6 | namespace FunctionalTests
7 | {
8 | public class UncreatableHub: Hub
9 | {
10 | public UncreatableHub(object obj)
11 | {
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/signalr/dist/esm/WeChatHttpClient.d.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient, HttpRequest, HttpResponse } from "./HttpClient";
2 | import { ILogger } from "./ILogger";
3 | export declare class WeChatHttpClient extends HttpClient {
4 | private readonly logger;
5 | constructor(logger: ILogger);
6 | /** @inheritdoc */
7 | send(request: HttpRequest): Promise;
8 | private knownStateTextMap;
9 | private mapStatusCode;
10 | }
11 |
--------------------------------------------------------------------------------
/signalr/dist/esm/Loggers.d.ts:
--------------------------------------------------------------------------------
1 | import { ILogger, LogLevel } from "./ILogger";
2 | /** A logger that does nothing when log messages are sent to it. */
3 | export declare class NullLogger implements ILogger {
4 | /** The singleton instance of the {@link @microsoft/signalr.NullLogger}. */
5 | static instance: ILogger;
6 | private constructor();
7 | /** @inheritDoc */
8 | log(_logLevel: LogLevel, _message: string): void;
9 | }
10 |
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/src/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | // Version token that will be replaced by the prepack command
5 | /** The version of the SignalR Message Pack protocol library. */
6 | export const VERSION = "0.0.0-DEV_BUILD";
7 |
8 | export { MessagePackHubProtocol } from "./MessagePackHubProtocol";
9 |
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/esm/index.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | // Version token that will be replaced by the prepack command
4 | /** The version of the SignalR Message Pack protocol library. */
5 | export var VERSION = "0.0.0-DEV_BUILD";
6 | export { MessagePackHubProtocol } from "./MessagePackHubProtocol";
7 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/FunctionalTests/ts/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | console.log("SignalR Functional Tests Loaded");
5 |
6 | // Prereqs
7 | import "es6-promise/dist/es6-promise.auto.js";
8 | import "./LogBannerReporter";
9 |
10 | // Tests
11 | import "./ConnectionTests";
12 | import "./HubConnectionTests";
13 | import "./WebSocketTests";
14 | import "./WebWorkerTests";
15 |
--------------------------------------------------------------------------------
/signalr/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.base.json",
3 |
4 | "include": [
5 | "./src/**/*"
6 | ],
7 | "exclude": [
8 | "./src/Polyfills.ts",
9 | "./src/WebSocketTransport.ts",
10 | "./src/NodeHttpClient.ts",
11 | "./src/XhrHttpClient.ts",
12 | "./src/FetchHttpClient.ts",
13 | "./src/xxxx.ts"
14 | ],
15 | "compilerOptions": {
16 | "types": [
17 | "miniprogram-api-typings"
18 | ]
19 | }
20 | }
--------------------------------------------------------------------------------
/common/common.npmproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 | false
7 | false
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/signalr/dist/esm/IConnection.d.ts:
--------------------------------------------------------------------------------
1 | import { TransferFormat } from "./ITransport";
2 | /** @private */
3 | export interface IConnection {
4 | readonly features: any;
5 | readonly connectionId?: string;
6 | baseUrl: string;
7 | start(transferFormat: TransferFormat): Promise;
8 | send(data: string | ArrayBuffer): Promise;
9 | stop(error?: Error): Promise;
10 | onreceive: ((data: string | ArrayBuffer) => void) | null;
11 | onclose: ((error?: Error) => void) | null;
12 | }
13 |
--------------------------------------------------------------------------------
/signalr/dist/esm/Polyfills.d.ts:
--------------------------------------------------------------------------------
1 | export declare type EventSourceConstructor = new (url: string, eventSourceInitDict?: EventSourceInit) => EventSource;
2 | export interface WebSocketConstructor {
3 | new (url: string, protocols?: string | string[], options?: any): WebSocket;
4 | readonly CLOSED: number;
5 | readonly CLOSING: number;
6 | readonly CONNECTING: number;
7 | readonly OPEN: number;
8 | }
9 | declare type WebSocket = any;
10 | declare type EventSource = any;
11 | declare type EventSourceInit = any;
12 | export {};
13 |
--------------------------------------------------------------------------------
/signalr/dist/esm/HandshakeProtocol.d.ts:
--------------------------------------------------------------------------------
1 | /** @private */
2 | export interface HandshakeRequestMessage {
3 | readonly protocol: string;
4 | readonly version: number;
5 | }
6 | /** @private */
7 | export interface HandshakeResponseMessage {
8 | readonly error: string;
9 | readonly minorVersion: number;
10 | }
11 | /** @private */
12 | export declare class HandshakeProtocol {
13 | writeHandshakeRequest(handshakeRequest: HandshakeRequestMessage): string;
14 | parseHandshakeResponse(data: any): [any, HandshakeResponseMessage];
15 | }
16 |
--------------------------------------------------------------------------------
/FunctionalTests/ComplexObject.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using System;
5 |
6 | namespace FunctionalTests
7 | {
8 | public class ComplexObject
9 | {
10 | public string String { get; set; }
11 | public int[] IntArray { get; set; }
12 | public byte[] ByteArray { get; set; }
13 | public Guid Guid { get; set; }
14 | public DateTime DateTime { get;set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/cjs/browser-index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"browser-index.js","sourceRoot":"","sources":["../../src/browser-index.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;;;;AAE/G,qHAAqH;AAErH,6BAAwB","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// This is where we add any polyfills we'll need for the browser. It is the entry module for browser-specific builds.\r\n\r\nexport * from \"./index\";\r\n"]}
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/esm/browser-index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"browser-index.js","sourceRoot":"","sources":["../../src/browser-index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,+GAA+G;AAE/G,qHAAqH;AAErH,cAAc,SAAS,CAAC","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// This is where we add any polyfills we'll need for the browser. It is the entry module for browser-specific builds.\r\n\r\nexport * from \"./index\";\r\n"]}
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "tslint:recommended",
3 | "rules": {
4 | "max-line-length": { "options": [300] },
5 | "member-ordering": false,
6 | "interface-name": false,
7 | "unified-signatures": false,
8 | "max-classes-per-file": false,
9 | "no-floating-promises": true,
10 | "no-empty": false,
11 | "no-bitwise": false,
12 | "no-console": false,
13 | "object-literal-shorthand":false,
14 | "object-literal-sort-keys": false,
15 | "trailing-comma":false
16 | }
17 | }
--------------------------------------------------------------------------------
/FunctionalTests/AuthorizedHub.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using Microsoft.AspNetCore.Authentication.JwtBearer;
5 | using Microsoft.AspNetCore.Authorization;
6 | using Microsoft.AspNetCore.SignalR;
7 |
8 | namespace FunctionalTests
9 | {
10 | [Authorize(JwtBearerDefaults.AuthenticationScheme)]
11 | public class HubWithAuthorization : Hub
12 | {
13 | public string Echo(string message) => message;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/src/Utils.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | // Copied from signalr/Utils.ts
5 | /** @private */
6 | export function isArrayBuffer(val: any): val is ArrayBuffer {
7 | return val && typeof ArrayBuffer !== "undefined" &&
8 | (val instanceof ArrayBuffer ||
9 | // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof
10 | (val.constructor && val.constructor.name === "ArrayBuffer"));
11 | }
12 |
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/cjs/browser-index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | function __export(m) {
5 | for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
6 | }
7 | Object.defineProperty(exports, "__esModule", { value: true });
8 | // This is where we add any polyfills we'll need for the browser. It is the entry module for browser-specific builds.
9 | __export(require("./index"));
10 | //# sourceMappingURL=browser-index.js.map
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/esm/Utils.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | // Copied from signalr/Utils.ts
4 | /** @private */
5 | export function isArrayBuffer(val) {
6 | return val && typeof ArrayBuffer !== "undefined" &&
7 | (val instanceof ArrayBuffer ||
8 | // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof
9 | (val.constructor && val.constructor.name === "ArrayBuffer"));
10 | }
11 | //# sourceMappingURL=Utils.js.map
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/webpack.config.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | const path = require("path");
5 | const baseConfig = require("../webpack.config.base");
6 |
7 | module.exports = baseConfig(__dirname, "signalr-protocol-msgpack", {
8 | externals: {
9 | msgpack5: "msgpack5",
10 | "@microsoft/signalr": "signalR"
11 | },
12 | alias: {
13 | buffer: path.resolve(__dirname, "node_modules", "buffer", "index.js"),
14 | },
15 | });
--------------------------------------------------------------------------------
/signalr/dist/esm/AbortController.d.ts:
--------------------------------------------------------------------------------
1 | /** @private */
2 | export declare class AbortController implements AbortSignal {
3 | private isAborted;
4 | onabort: (() => void) | null;
5 | abort(): void;
6 | readonly signal: AbortSignal;
7 | readonly aborted: boolean;
8 | }
9 | /** Represents a signal that can be monitored to determine if a request has been aborted. */
10 | export interface AbortSignal {
11 | /** Indicates if the request has been aborted. */
12 | aborted: boolean;
13 | /** Set this to a handler that will be invoked when the request is aborted. */
14 | onabort: (() => void) | null;
15 | }
16 |
--------------------------------------------------------------------------------
/FunctionalTests/ts/Utils.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | export function getParameterByName(name: string) {
5 | const url = window.location.href;
6 | name = name.replace(/[\[\]]/g, "\\$&");
7 | const regex = new RegExp("[?&]" + name + "(=([^]*)|&|#|$)");
8 | const results = regex.exec(url);
9 | if (!results) {
10 | return null;
11 | }
12 | if (!results[2]) {
13 | return "";
14 | }
15 | return decodeURIComponent(results[2].replace(/\+/g, " "));
16 | }
17 |
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/cjs/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | Object.defineProperty(exports, "__esModule", { value: true });
5 | // Version token that will be replaced by the prepack command
6 | /** The version of the SignalR Message Pack protocol library. */
7 | exports.VERSION = "0.0.0-DEV_BUILD";
8 | var MessagePackHubProtocol_1 = require("./MessagePackHubProtocol");
9 | exports.MessagePackHubProtocol = MessagePackHubProtocol_1.MessagePackHubProtocol;
10 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/signalr/dist/esm/DefaultHttpClient.d.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient, HttpRequest, HttpResponse } from "./HttpClient";
2 | import { ILogger } from "./ILogger";
3 | /** Default implementation of {@link @microsoft/signalr.HttpClient}. */
4 | export declare class DefaultHttpClient extends HttpClient {
5 | private readonly httpClient;
6 | /** Creates a new instance of the {@link @microsoft/signalr.DefaultHttpClient}, using the provided {@link @microsoft/signalr.ILogger} to log messages. */
7 | constructor(logger: ILogger);
8 | /** @inheritDoc */
9 | send(request: HttpRequest): Promise;
10 | getCookieString(url: string): string;
11 | }
12 |
--------------------------------------------------------------------------------
/signalr/webpack.config.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | const baseConfig = require("../webpack.config.base");
4 | module.exports = env => baseConfig(__dirname, "signalr", {
5 | // These are only used in Node environments
6 | // so we tell webpack not to pull them in for the browser
7 | target: env && env.platform ? env.platform : undefined,
8 | platformDist: env && env.platform ? env.platform : undefined,
9 | externals: [
10 | "websocket",
11 | "eventsource",
12 | "request"
13 | ]
14 | });
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/cjs/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;AAE/G,6DAA6D;AAC7D,gEAAgE;AACnD,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,mEAAkE;AAAzD,0DAAA,sBAAsB,CAAA","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// Version token that will be replaced by the prepack command\r\n/** The version of the SignalR Message Pack protocol library. */\r\nexport const VERSION = \"0.0.0-DEV_BUILD\";\r\n\r\nexport { MessagePackHubProtocol } from \"./MessagePackHubProtocol\";\r\n"]}
--------------------------------------------------------------------------------
/signalr/src/Loggers.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | import { ILogger, LogLevel } from "./ILogger";
5 |
6 | /** A logger that does nothing when log messages are sent to it. */
7 | export class NullLogger implements ILogger {
8 | /** The singleton instance of the {@link @microsoft/signalr.NullLogger}. */
9 | public static instance: ILogger = new NullLogger();
10 |
11 | private constructor() {}
12 |
13 | /** @inheritDoc */
14 | // tslint:disable-next-line
15 | public log(_logLevel: LogLevel, _message: string): void {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/FunctionalTests/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/client-ts.npmproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 | false
7 | true
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/signalr/src/IConnection.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | import { TransferFormat } from "./ITransport";
5 |
6 | /** @private */
7 | export interface IConnection {
8 | readonly features: any;
9 | readonly connectionId?: string;
10 |
11 | baseUrl: string;
12 |
13 | start(transferFormat: TransferFormat): Promise;
14 | send(data: string | ArrayBuffer): Promise;
15 | stop(error?: Error): Promise;
16 |
17 | onreceive: ((data: string | ArrayBuffer) => void) | null;
18 | onclose: ((error?: Error) => void) | null;
19 | }
20 |
--------------------------------------------------------------------------------
/wx-demo/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 | miniprogram-api-typings@^2.8.3:
6 | version "2.8.3"
7 | resolved "https://registry.yarnpkg.com/miniprogram-api-typings/-/miniprogram-api-typings-2.8.3.tgz#e783b56c40b3595bbf2ed3118eef61776f3fea50"
8 | integrity sha512-dAPKHx3Kkgr6iiPM3EVTLLbVBd37A+ro9NmgbhzY2C2wGI/p563sGRjQeu7VhZGhV5infHawsBIPTmlGghjrUg==
9 |
10 | typescript@^3.3.3333:
11 | version "3.6.3"
12 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.3.tgz#fea942fabb20f7e1ca7164ff626f1a9f3f70b4da"
13 | integrity sha512-N7bceJL1CtRQ2RiG0AQME13ksR7DiuQh/QehubYcghzv20tnh+MQnQIuJddTmsbqYj+dztchykemz0zFzlvdQw==
14 |
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/esm/index.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,+GAA+G;AAE/G,6DAA6D;AAC7D,gEAAgE;AAChE,MAAM,CAAC,IAAM,OAAO,GAAG,iBAAiB,CAAC;AAEzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// Version token that will be replaced by the prepack command\r\n/** The version of the SignalR Message Pack protocol library. */\r\nexport const VERSION = \"0.0.0-DEV_BUILD\";\r\n\r\nexport { MessagePackHubProtocol } from \"./MessagePackHubProtocol\";\r\n"]}
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/cjs/Utils.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | Object.defineProperty(exports, "__esModule", { value: true });
5 | // Copied from signalr/Utils.ts
6 | /** @private */
7 | function isArrayBuffer(val) {
8 | return val && typeof ArrayBuffer !== "undefined" &&
9 | (val instanceof ArrayBuffer ||
10 | // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof
11 | (val.constructor && val.constructor.name === "ArrayBuffer"));
12 | }
13 | exports.isArrayBuffer = isArrayBuffer;
14 | //# sourceMappingURL=Utils.js.map
--------------------------------------------------------------------------------
/signalr/dist/esm/Loggers.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | /** A logger that does nothing when log messages are sent to it. */
4 | var NullLogger = /** @class */ (function () {
5 | function NullLogger() {
6 | }
7 | /** @inheritDoc */
8 | // tslint:disable-next-line
9 | NullLogger.prototype.log = function (_logLevel, _message) {
10 | };
11 | /** The singleton instance of the {@link @microsoft/signalr.NullLogger}. */
12 | NullLogger.instance = new NullLogger();
13 | return NullLogger;
14 | }());
15 | export { NullLogger };
16 | //# sourceMappingURL=Loggers.js.map
--------------------------------------------------------------------------------
/signalr/src/Polyfills.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | // Not exported from index
5 |
6 | export type EventSourceConstructor = new (url: string, eventSourceInitDict?: EventSourceInit) => EventSource;
7 |
8 | export interface WebSocketConstructor {
9 | new(url: string, protocols?: string | string[], options?: any): WebSocket;
10 | readonly CLOSED: number;
11 | readonly CLOSING: number;
12 | readonly CONNECTING: number;
13 | readonly OPEN: number;
14 | }
15 |
16 | declare type WebSocket = any;
17 | declare type EventSource = any;
18 | declare type EventSourceInit = any;
19 |
--------------------------------------------------------------------------------
/signalr/signalr.npmproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | @microsoft/signalr
6 | true
7 | false
8 | true
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/signalr/tests/TestTransport.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | import { ITransport } from "signalr/src/ITransport";
5 |
6 | export class TestTransport implements ITransport {
7 | public connect() {
8 | return Promise.resolve();
9 | }
10 |
11 | public send(): Promise {
12 | return Promise.resolve();
13 | }
14 |
15 | public stop(): Promise {
16 | return Promise.resolve();
17 | }
18 |
19 | public onreceive: ((data: string | ArrayBuffer) => void) | null = null;
20 | public onclose: ((error?: Error | undefined) => void) | null = null;
21 | }
22 |
--------------------------------------------------------------------------------
/EchoServer/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:5008",
7 | "sslPort": 5009
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "EchoServer": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "applicationUrl": "http://localhost:5009;",
22 | "environmentVariables": {
23 | "ASPNETCORE_ENVIRONMENT": "Development"
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/common/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "common",
3 | "version": "1.0.0",
4 | "description": "Common dependencies used during dev time. DO NOT PUBLISH",
5 | "private": true,
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "devDependencies": {
13 | "@types/jest": "^23.3.2",
14 | "@types/node": "^8.5.2",
15 | "@types/webpack": "^4.4.0",
16 | "jest": "^24.1.0",
17 | "jest-junit": "^6.4.0",
18 | "rimraf": "^2.6.2",
19 | "ts-jest": "^24.0.2",
20 | "ts-loader": "^4.4.1",
21 | "tslint": "^5.9.1",
22 | "typescript": "^3.6.2",
23 | "uglify-js": "^3.3.5",
24 | "webpack": "^4.12.0",
25 | "webpack-cli": "^3.0.3"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "client-ts",
3 | "version": "0.0.0",
4 | "description": "Provides a root to run npm scripts from. DO NOT PUBLISH",
5 | "private": true,
6 | "scripts": {
7 | "build": "cd ./signalr && yarn run build && cd ../signalr-protocol-msgpack && yarn run build",
8 | "pretest": "node ./common/node_modules/tslint/bin/tslint -c ./tslint.json -p ./signalr/tests/tsconfig.json && node ./common/node_modules/tslint/bin/tslint -c ./tslint.json -p ./signalr-protocol-msgpack/tests/tsconfig.json",
9 | "test": "node ./common/node_modules/jest/bin/jest.js --config ./jest.config.js",
10 | "coverage": "node ./common/node_modules/jest/bin/jest.js --config ./jest.config.js --coverage"
11 | },
12 | "author": "Microsoft",
13 | "license": "Apache-2.0"
14 | }
15 |
--------------------------------------------------------------------------------
/EchoServer/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Hosting;
6 | using Microsoft.Extensions.Configuration;
7 | using Microsoft.Extensions.Hosting;
8 | using Microsoft.Extensions.Logging;
9 |
10 | namespace EchoServer
11 | {
12 | public class Program
13 | {
14 | public static void Main(string[] args)
15 | {
16 | CreateHostBuilder(args).Build().Run();
17 | }
18 |
19 | public static IHostBuilder CreateHostBuilder(string[] args) =>
20 | Host.CreateDefaultBuilder(args)
21 | .ConfigureWebHostDefaults(webBuilder =>
22 | {
23 | webBuilder.UseStartup();
24 | });
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/signalr/dist/cjs/Loggers.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | Object.defineProperty(exports, "__esModule", { value: true });
5 | /** A logger that does nothing when log messages are sent to it. */
6 | var NullLogger = /** @class */ (function () {
7 | function NullLogger() {
8 | }
9 | /** @inheritDoc */
10 | // tslint:disable-next-line
11 | NullLogger.prototype.log = function (_logLevel, _message) {
12 | };
13 | /** The singleton instance of the {@link @microsoft/signalr.NullLogger}. */
14 | NullLogger.instance = new NullLogger();
15 | return NullLogger;
16 | }());
17 | exports.NullLogger = NullLogger;
18 | //# sourceMappingURL=Loggers.js.map
--------------------------------------------------------------------------------
/signalr/dist/cjs/IConnection.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"IConnection.js","sourceRoot":"","sources":["../../src/IConnection.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\nimport { TransferFormat } from \"./ITransport\";\r\n\r\n/** @private */\r\nexport interface IConnection {\r\n readonly features: any;\r\n readonly connectionId?: string;\r\n\r\n baseUrl: string;\r\n\r\n start(transferFormat: TransferFormat): Promise;\r\n send(data: string | ArrayBuffer): Promise;\r\n stop(error?: Error): Promise;\r\n\r\n onreceive: ((data: string | ArrayBuffer) => void) | null;\r\n onclose: ((error?: Error) => void) | null;\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/dist/esm/IConnection.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"IConnection.js","sourceRoot":"","sources":["../../src/IConnection.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,+GAA+G","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\nimport { TransferFormat } from \"./ITransport\";\r\n\r\n/** @private */\r\nexport interface IConnection {\r\n readonly features: any;\r\n readonly connectionId?: string;\r\n\r\n baseUrl: string;\r\n\r\n start(transferFormat: TransferFormat): Promise;\r\n send(data: string | ArrayBuffer): Promise;\r\n stop(error?: Error): Promise;\r\n\r\n onreceive: ((data: string | ArrayBuffer) => void) | null;\r\n onclose: ((error?: Error) => void) | null;\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/dist/cjs/Polyfills.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"Polyfills.js","sourceRoot":"","sources":["../../src/Polyfills.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// Not exported from index\r\n\r\nexport type EventSourceConstructor = new (url: string, eventSourceInitDict?: EventSourceInit) => EventSource;\r\n\r\nexport interface WebSocketConstructor {\r\n new(url: string, protocols?: string | string[], options?: any): WebSocket;\r\n readonly CLOSED: number;\r\n readonly CLOSING: number;\r\n readonly CONNECTING: number;\r\n readonly OPEN: number;\r\n}\r\n\r\ndeclare type WebSocket = any;\r\ndeclare type EventSource = any;\r\ndeclare type EventSourceInit = any;\r\n"]}
--------------------------------------------------------------------------------
/signalr/dist/esm/Polyfills.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"Polyfills.js","sourceRoot":"","sources":["../../src/Polyfills.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,+GAA+G","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// Not exported from index\r\n\r\nexport type EventSourceConstructor = new (url: string, eventSourceInitDict?: EventSourceInit) => EventSource;\r\n\r\nexport interface WebSocketConstructor {\r\n new(url: string, protocols?: string | string[], options?: any): WebSocket;\r\n readonly CLOSED: number;\r\n readonly CLOSING: number;\r\n readonly CONNECTING: number;\r\n readonly OPEN: number;\r\n}\r\n\r\ndeclare type WebSocket = any;\r\ndeclare type EventSource = any;\r\ndeclare type EventSourceInit = any;\r\n"]}
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WeChatApp.SignalR
2 | 适用于 微信小程序的SignalR (SignalRCore)
3 |
4 | 目前该项目支持一下 Transport / Follow Transports are supported right now
5 | - [x] WeChatWebSocketTransport
6 | - [x] JsonProtocal
7 | - [x] TextFormate
8 | - [ ] Binary (not test yet)
9 | - [ ] ~~ServerSentEventTransport~~ Does it possible to use SSE on wechat miniprogram
10 | - [ ] JsonProtocal
11 | - [ ] TextFormate
12 | - [ ] Binary (not test yet)
13 | - [ ] WeChatLongPollingTransport
14 | - [ ] JsonProtocal
15 | - [ ] TextFormate
16 | - [ ] Binary (not test yet)
17 |
18 | ## build requirement
19 | 1. use [yarn](https://yarnpkg.com/) to support "packagename":"links:../signlar" like path
20 | 2. [dotnet core 3.0](https://dot.net) to run the EchoServer
21 | 3. [wechat dev tool](https://developers.weixin.qq.com/miniprogram/dev/devtools/devtools.html)
22 |
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/signalr-protocol-msgpack.npmproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | @microsoft/signalr-protocol-msgpack
6 | true
7 | false
8 | true
9 | true
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/signalr/dist/esm/WeChatWebSocketTransport.d.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient } from "./HttpClient";
2 | import { ILogger } from "./ILogger";
3 | import { ITransport, TransferFormat } from "./ITransport";
4 | export declare class WeChatWebSocketTransport implements ITransport {
5 | private readonly httpClient;
6 | private readonly accessTokenFactory;
7 | private readonly logger;
8 | private readonly logMessageContent;
9 | private webSocket;
10 | constructor(httpClient: HttpClient, accessTokenFactory: (() => string | Promise) | undefined, logger: ILogger, logMessageContent: boolean);
11 | connect(url: string, transferFormat: TransferFormat): Promise;
12 | onreceive: ((data: string | ArrayBuffer) => void) | null;
13 | onclose: ((error?: Error | undefined) => void) | null;
14 | send(data: any): Promise;
15 | stop(): Promise;
16 | private close;
17 | }
18 |
--------------------------------------------------------------------------------
/signalr/src/EmptyNodeHttpClient.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | // This is an empty implementation of the NodeHttpClient that will be included in browser builds so the output file will be smaller
5 |
6 | import { HttpClient, HttpResponse } from "./HttpClient";
7 | import { ILogger } from "./ILogger";
8 |
9 | export class NodeHttpClient extends HttpClient {
10 | // @ts-ignore: Need ILogger to compile, but unused variables generate errors
11 | public constructor(logger: ILogger) {
12 | super();
13 | }
14 |
15 | public send(): Promise {
16 | return Promise.reject(new Error("If using Node either provide an XmlHttpRequest polyfill or consume the cjs or esm script instead of the browser/signalr.js one."));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/wx-demo/miniprogram/utils/util.ts:
--------------------------------------------------------------------------------
1 | export function formatTime(date: Date): string {
2 | const year = date.getFullYear()
3 | const month = date.getMonth() + 1
4 | const day = date.getDate()
5 | const hour = date.getHours()
6 | const minute = date.getMinutes()
7 | const second = date.getSeconds()
8 |
9 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
10 | }
11 |
12 | const formatNumber = (n: number) => {
13 | const str = n.toString()
14 | return str[1] ? str : '0' + str
15 | }
16 |
17 |
18 | export function parseMessage(message:string):[string,number]{
19 | if(!message){
20 | throw new Error(`message is null`);
21 | }
22 | let arr = message.split(" ");
23 | if(arr.length != 2){
24 | throw new Error(`invalid args:${ message}`);
25 | }
26 | let p = arr[0];
27 | let id = parseInt(arr[1]);
28 |
29 | return [p,id];
30 | }
--------------------------------------------------------------------------------
/signalr/src/DefaultReconnectPolicy.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | import { IRetryPolicy, RetryContext } from "./IRetryPolicy";
5 |
6 | // 0, 2, 10, 30 second delays before reconnect attempts.
7 | const DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2000, 10000, 30000, null];
8 |
9 | /** @private */
10 | export class DefaultReconnectPolicy implements IRetryPolicy {
11 | private readonly retryDelays: Array;
12 |
13 | constructor(retryDelays?: number[]) {
14 | this.retryDelays = retryDelays !== undefined ? [...retryDelays, null] : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS;
15 | }
16 |
17 | public nextRetryDelayInMilliseconds(retryContext: RetryContext): number | null {
18 | return this.retryDelays[retryContext.previousRetryCount];
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/esm/Utils.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../src/Utils.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,+GAA+G;AAE/G,+BAA+B;AAC/B,eAAe;AACf,MAAM,UAAU,aAAa,CAAC,GAAQ;IAClC,OAAO,GAAG,IAAI,OAAO,WAAW,KAAK,WAAW;QAC5C,CAAC,GAAG,YAAY,WAAW;YAC3B,kEAAkE;YAClE,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC;AACrE,CAAC","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// Copied from signalr/Utils.ts\r\n/** @private */\r\nexport function isArrayBuffer(val: any): val is ArrayBuffer {\r\n return val && typeof ArrayBuffer !== \"undefined\" &&\r\n (val instanceof ArrayBuffer ||\r\n // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof\r\n (val.constructor && val.constructor.name === \"ArrayBuffer\"));\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/src/TextMessageFormat.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | // Not exported from index
5 | /** @private */
6 | export class TextMessageFormat {
7 | public static RecordSeparatorCode = 0x1e;
8 | public static RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);
9 |
10 | public static write(output: string): string {
11 | return `${output}${TextMessageFormat.RecordSeparator}`;
12 | }
13 |
14 | public static parse(input: string): string[] {
15 | if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {
16 | throw new Error("Message is incomplete.");
17 | }
18 |
19 | const messages = input.split(TextMessageFormat.RecordSeparator);
20 | messages.pop();
21 | return messages;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/cjs/Utils.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../src/Utils.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;AAE/G,+BAA+B;AAC/B,eAAe;AACf,SAAgB,aAAa,CAAC,GAAQ;IAClC,OAAO,GAAG,IAAI,OAAO,WAAW,KAAK,WAAW;QAC5C,CAAC,GAAG,YAAY,WAAW;YAC3B,kEAAkE;YAClE,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC;AACrE,CAAC;AALD,sCAKC","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// Copied from signalr/Utils.ts\r\n/** @private */\r\nexport function isArrayBuffer(val: any): val is ArrayBuffer {\r\n return val && typeof ArrayBuffer !== \"undefined\" &&\r\n (val instanceof ArrayBuffer ||\r\n // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof\r\n (val.constructor && val.constructor.name === \"ArrayBuffer\"));\r\n}\r\n"]}
--------------------------------------------------------------------------------
/wx-demo/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目配置文件",
3 | "packOptions": {
4 | "ignore": []
5 | },
6 | "miniprogramRoot": "miniprogram/",
7 | "compileType": "miniprogram",
8 | "libVersion": "2.4.0",
9 | "projectname": "wx-demo",
10 | "scripts": {
11 | "beforeCompile": "npm run tsc",
12 | "beforePreview": "npm run tsc",
13 | "beforeUpload": "npm run tsc"
14 | },
15 | "setting": {
16 | "urlCheck": false,
17 | "es6": true,
18 | "enhance": false,
19 | "postcss": true,
20 | "minified": true,
21 | "newFeature": true,
22 | "coverView": true,
23 | "nodeModules": true,
24 | "autoAudits": false,
25 | "checkInvalidKey": true,
26 | "checkSiteMap": true,
27 | "uploadWithSourceMap": true,
28 | "babelSetting": {
29 | "ignore": [],
30 | "disablePlugins": [],
31 | "outputPath": ""
32 | }
33 | },
34 | "appid": "wxe9ed4bd72942d888",
35 | "simulatorType": "wechat",
36 | "simulatorPluginLibVersion": {},
37 | "condition": {}
38 | }
--------------------------------------------------------------------------------
/signalr/dist/esm/index.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | // Version token that will be replaced by the prepack command
4 | /** The version of the SignalR client. */
5 | export var VERSION = "0.0.0-DEV_BUILD";
6 | export { AbortError, HttpError, TimeoutError } from "./Errors";
7 | export { HttpClient, HttpResponse } from "./HttpClient";
8 | export { DefaultHttpClient } from "./DefaultHttpClient";
9 | export { HubConnection, HubConnectionState } from "./HubConnection";
10 | export { HubConnectionBuilder } from "./HubConnectionBuilder";
11 | export { MessageType } from "./IHubProtocol";
12 | export { LogLevel } from "./ILogger";
13 | export { HttpTransportType, TransferFormat } from "./ITransport";
14 | export { NullLogger } from "./Loggers";
15 | export { JsonHubProtocol } from "./JsonHubProtocol";
16 | export { Subject } from "./Subject";
17 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/signalr/dist/esm/Loggers.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"Loggers.js","sourceRoot":"","sources":["../../src/Loggers.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,+GAA+G;AAI/G,mEAAmE;AACnE;IAII;IAAuB,CAAC;IAExB,kBAAkB;IAClB,2BAA2B;IACpB,wBAAG,GAAV,UAAW,SAAmB,EAAE,QAAgB;IAChD,CAAC;IARD,2EAA2E;IAC7D,mBAAQ,GAAY,IAAI,UAAU,EAAE,CAAC;IAQvD,iBAAC;CAAA,AAVD,IAUC;SAVY,UAAU","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\n\r\n/** A logger that does nothing when log messages are sent to it. */\r\nexport class NullLogger implements ILogger {\r\n /** The singleton instance of the {@link @microsoft/signalr.NullLogger}. */\r\n public static instance: ILogger = new NullLogger();\r\n\r\n private constructor() {}\r\n\r\n /** @inheritDoc */\r\n // tslint:disable-next-line\r\n public log(_logLevel: LogLevel, _message: string): void {\r\n }\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/dist/cjs/Loggers.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"Loggers.js","sourceRoot":"","sources":["../../src/Loggers.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;AAI/G,mEAAmE;AACnE;IAII;IAAuB,CAAC;IAExB,kBAAkB;IAClB,2BAA2B;IACpB,wBAAG,GAAV,UAAW,SAAmB,EAAE,QAAgB;IAChD,CAAC;IARD,2EAA2E;IAC7D,mBAAQ,GAAY,IAAI,UAAU,EAAE,CAAC;IAQvD,iBAAC;CAAA,AAVD,IAUC;AAVY,gCAAU","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\n\r\n/** A logger that does nothing when log messages are sent to it. */\r\nexport class NullLogger implements ILogger {\r\n /** The singleton instance of the {@link @microsoft/signalr.NullLogger}. */\r\n public static instance: ILogger = new NullLogger();\r\n\r\n private constructor() {}\r\n\r\n /** @inheritDoc */\r\n // tslint:disable-next-line\r\n public log(_logLevel: LogLevel, _message: string): void {\r\n }\r\n}\r\n"]}
--------------------------------------------------------------------------------
/tsconfig.base.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "module": "es2015",
5 | "target": "es5",
6 | "sourceMap": true,
7 | "moduleResolution": "node",
8 | "inlineSources": true,
9 | "emitDecoratorMetadata": true,
10 | "experimentalDecorators": true,
11 | "removeComments": false,
12 | "noImplicitAny": true,
13 | "noUnusedLocals": true,
14 | "noUnusedParameters": true,
15 | "suppressImplicitAnyIndexErrors": true,
16 | "noEmitOnError": true,
17 | "skipLibCheck": true,
18 | "stripInternal": true,
19 | "strict": true,
20 | "lib": [ "es5", "es2015.promise", "es2015.iterable" ],
21 | "baseUrl": ".",
22 | "paths": {
23 | "wechat-app-signalr": [
24 | "./signalr"
25 | ],
26 | "@microsoft/signalr-protocol-msgpack": [
27 | "./signalr-protocol-msgpack"
28 | ]
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/signalr/dist/esm/IRetryPolicy.d.ts:
--------------------------------------------------------------------------------
1 | /** An abstraction that controls when the client attempts to reconnect and how many times it does so. */
2 | export interface IRetryPolicy {
3 | /** Called after the transport loses the connection.
4 | *
5 | * @param {RetryContext} retryContext Details related to the retry event to help determine how long to wait for the next retry.
6 | *
7 | * @returns {number | null} The amount of time in milliseconds to wait before the next retry. `null` tells the client to stop retrying.
8 | */
9 | nextRetryDelayInMilliseconds(retryContext: RetryContext): number | null;
10 | }
11 | export interface RetryContext {
12 | /**
13 | * The number of consecutive failed tries so far.
14 | */
15 | readonly previousRetryCount: number;
16 | /**
17 | * The amount of time in milliseconds spent retrying so far.
18 | */
19 | readonly elapsedMilliseconds: number;
20 | /**
21 | * The error that forced the upcoming retry.
22 | */
23 | readonly retryReason: Error;
24 | }
25 |
--------------------------------------------------------------------------------
/signalr/dist/esm/TextMessageFormat.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | // Not exported from index
4 | /** @private */
5 | var TextMessageFormat = /** @class */ (function () {
6 | function TextMessageFormat() {
7 | }
8 | TextMessageFormat.write = function (output) {
9 | return "" + output + TextMessageFormat.RecordSeparator;
10 | };
11 | TextMessageFormat.parse = function (input) {
12 | if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {
13 | throw new Error("Message is incomplete.");
14 | }
15 | var messages = input.split(TextMessageFormat.RecordSeparator);
16 | messages.pop();
17 | return messages;
18 | };
19 | TextMessageFormat.RecordSeparatorCode = 0x1e;
20 | TextMessageFormat.RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);
21 | return TextMessageFormat;
22 | }());
23 | export { TextMessageFormat };
24 | //# sourceMappingURL=TextMessageFormat.js.map
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | module.exports = {
5 | globals: {
6 | "ts-jest": {
7 | "tsConfig": "./tsconfig.jest.json",
8 | "babelConfig": true,
9 | "diagnostics": true
10 | }
11 | },
12 | reporters: [
13 | "default",
14 | ["./common/node_modules/jest-junit/index.js", { "output": "../../../../artifacts/log/" + `${process.platform}` + ".signalr.junit.xml" }]
15 | ],
16 | transform: {
17 | "^.+\\.tsx?$": "./common/node_modules/ts-jest"
18 | },
19 | testEnvironment: "node",
20 | testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
21 | moduleNameMapper: {
22 | "^ts-jest$": "/common/node_modules/ts-jest",
23 | "^@microsoft/signalr$": "/signalr/dist/cjs/index.js"
24 | },
25 | moduleFileExtensions: [
26 | "ts",
27 | "tsx",
28 | "js",
29 | "jsx",
30 | "json",
31 | "node"
32 | ]
33 | };
34 |
--------------------------------------------------------------------------------
/signalr/dist/esm/ITransport.d.ts:
--------------------------------------------------------------------------------
1 | /** Specifies a specific HTTP transport type. */
2 | export declare enum HttpTransportType {
3 | /** Specifies no transport preference. */
4 | None = 0,
5 | /** Specifies the WebSockets transport. */
6 | WebSockets = 1,
7 | /** Specifies the Server-Sent Events transport. */
8 | ServerSentEvents = 2,
9 | /** Specifies the Long Polling transport. */
10 | LongPolling = 4
11 | }
12 | /** Specifies the transfer format for a connection. */
13 | export declare enum TransferFormat {
14 | /** Specifies that only text data will be transmitted over the connection. */
15 | Text = 1,
16 | /** Specifies that binary data will be transmitted over the connection. */
17 | Binary = 2
18 | }
19 | /** An abstraction over the behavior of transports. This is designed to support the framework and not intended for use by applications. */
20 | export interface ITransport {
21 | connect(url: string, transferFormat: TransferFormat): Promise;
22 | send(data: any): Promise;
23 | stop(): Promise;
24 | onreceive: ((data: string | ArrayBuffer) => void) | null;
25 | onclose: ((error?: Error) => void) | null;
26 | }
27 |
--------------------------------------------------------------------------------
/signalr/dist/cjs/TextMessageFormat.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | Object.defineProperty(exports, "__esModule", { value: true });
5 | // Not exported from index
6 | /** @private */
7 | var TextMessageFormat = /** @class */ (function () {
8 | function TextMessageFormat() {
9 | }
10 | TextMessageFormat.write = function (output) {
11 | return "" + output + TextMessageFormat.RecordSeparator;
12 | };
13 | TextMessageFormat.parse = function (input) {
14 | if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {
15 | throw new Error("Message is incomplete.");
16 | }
17 | var messages = input.split(TextMessageFormat.RecordSeparator);
18 | messages.pop();
19 | return messages;
20 | };
21 | TextMessageFormat.RecordSeparatorCode = 0x1e;
22 | TextMessageFormat.RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);
23 | return TextMessageFormat;
24 | }());
25 | exports.TextMessageFormat = TextMessageFormat;
26 | //# sourceMappingURL=TextMessageFormat.js.map
--------------------------------------------------------------------------------
/signalr/src/IRetryPolicy.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | /** An abstraction that controls when the client attempts to reconnect and how many times it does so. */
5 | export interface IRetryPolicy {
6 | /** Called after the transport loses the connection.
7 | *
8 | * @param {RetryContext} retryContext Details related to the retry event to help determine how long to wait for the next retry.
9 | *
10 | * @returns {number | null} The amount of time in milliseconds to wait before the next retry. `null` tells the client to stop retrying.
11 | */
12 | nextRetryDelayInMilliseconds(retryContext: RetryContext): number | null;
13 | }
14 |
15 | export interface RetryContext {
16 | /**
17 | * The number of consecutive failed tries so far.
18 | */
19 | readonly previousRetryCount: number;
20 |
21 | /**
22 | * The amount of time in milliseconds spent retrying so far.
23 | */
24 | readonly elapsedMilliseconds: number;
25 |
26 | /**
27 | * The error that forced the upcoming retry.
28 | */
29 | readonly retryReason: Error;
30 | }
31 |
--------------------------------------------------------------------------------
/signalr/dist/esm/Errors.d.ts:
--------------------------------------------------------------------------------
1 | /** Error thrown when an HTTP request fails. */
2 | export declare class HttpError extends Error {
3 | private __proto__;
4 | /** The HTTP status code represented by this error. */
5 | statusCode: number;
6 | /** Constructs a new instance of {@link @microsoft/signalr.HttpError}.
7 | *
8 | * @param {string} errorMessage A descriptive error message.
9 | * @param {number} statusCode The HTTP status code represented by this error.
10 | */
11 | constructor(errorMessage: string, statusCode: number);
12 | }
13 | /** Error thrown when a timeout elapses. */
14 | export declare class TimeoutError extends Error {
15 | private __proto__;
16 | /** Constructs a new instance of {@link @microsoft/signalr.TimeoutError}.
17 | *
18 | * @param {string} errorMessage A descriptive error message.
19 | */
20 | constructor(errorMessage?: string);
21 | }
22 | /** Error thrown when an action is aborted. */
23 | export declare class AbortError extends Error {
24 | private __proto__;
25 | /** Constructs a new instance of {@link AbortError}.
26 | *
27 | * @param {string} errorMessage A descriptive error message.
28 | */
29 | constructor(errorMessage?: string);
30 | }
31 |
--------------------------------------------------------------------------------
/signalr/dist/esm/index.d.ts:
--------------------------------------------------------------------------------
1 | /** The version of the SignalR client. */
2 | export declare const VERSION: string;
3 | export { AbortSignal } from "./AbortController";
4 | export { AbortError, HttpError, TimeoutError } from "./Errors";
5 | export { HttpClient, HttpRequest, HttpResponse } from "./HttpClient";
6 | export { DefaultHttpClient } from "./DefaultHttpClient";
7 | export { IHttpConnectionOptions } from "./IHttpConnectionOptions";
8 | export { HubConnection, HubConnectionState } from "./HubConnection";
9 | export { HubConnectionBuilder } from "./HubConnectionBuilder";
10 | export { MessageType, MessageHeaders, HubMessage, HubMessageBase, HubInvocationMessage, InvocationMessage, StreamInvocationMessage, StreamItemMessage, CompletionMessage, PingMessage, CloseMessage, CancelInvocationMessage, IHubProtocol } from "./IHubProtocol";
11 | export { ILogger, LogLevel } from "./ILogger";
12 | export { HttpTransportType, TransferFormat, ITransport } from "./ITransport";
13 | export { IStreamSubscriber, IStreamResult, ISubscription } from "./Stream";
14 | export { NullLogger } from "./Loggers";
15 | export { JsonHubProtocol } from "./JsonHubProtocol";
16 | export { Subject } from "./Subject";
17 | export { IRetryPolicy, RetryContext } from "./IRetryPolicy";
18 |
19 | export as namespace signalR;
--------------------------------------------------------------------------------
/wx-demo/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "strictNullChecks": true,
4 | "noImplicitAny": true,
5 | "module": "CommonJS",
6 | "target": "es5",
7 | "allowJs": false,
8 | "experimentalDecorators": true,
9 | "noImplicitThis": true,
10 | "noImplicitReturns": true,
11 | "alwaysStrict": true,
12 | "inlineSourceMap": true,
13 | "inlineSources": true,
14 | "noFallthroughCasesInSwitch": true,
15 | "noUnusedLocals": true,
16 | "noUnusedParameters": true,
17 | "strict": true,
18 | "removeComments": true,
19 | "pretty": true,
20 | "strictPropertyInitialization": true,
21 | "typeRoots": [
22 | "./typings"
23 | ],
24 | "skipLibCheck": true,
25 | "lib": [ "es2015","es2015.promise" ],
26 | "rootDir": "./miniprogram",
27 | "baseUrl": ".",
28 | "paths": {
29 | "wechat-app-signalr": [
30 | "../signalr"
31 | ],
32 | "@microsoft/signalr-protocol-msgpack": [
33 | "./signalr-protocol-msgpack"
34 | ]
35 | },
36 | "types": [
37 | "miniprogram-api-typings"
38 | ]
39 | },
40 | "include": [
41 | "./miniprogram/**/*.ts"
42 | ],
43 | "exclude": [
44 | "node_modules",
45 | "miniprogram_dist",
46 | "**/*.spec.ts"
47 | ]
48 | }
49 |
--------------------------------------------------------------------------------
/signalr/dist/esm/DefaultReconnectPolicy.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | var __spreadArrays = (this && this.__spreadArrays) || function () {
4 | for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
5 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
6 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
7 | r[k] = a[j];
8 | return r;
9 | };
10 | // 0, 2, 10, 30 second delays before reconnect attempts.
11 | var DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2000, 10000, 30000, null];
12 | /** @private */
13 | var DefaultReconnectPolicy = /** @class */ (function () {
14 | function DefaultReconnectPolicy(retryDelays) {
15 | this.retryDelays = retryDelays !== undefined ? __spreadArrays(retryDelays, [null]) : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS;
16 | }
17 | DefaultReconnectPolicy.prototype.nextRetryDelayInMilliseconds = function (retryContext) {
18 | return this.retryDelays[retryContext.previousRetryCount];
19 | };
20 | return DefaultReconnectPolicy;
21 | }());
22 | export { DefaultReconnectPolicy };
23 | //# sourceMappingURL=DefaultReconnectPolicy.js.map
--------------------------------------------------------------------------------
/signalr/tests/AbortSignal.test.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | import { AbortController } from "../src/AbortController";
5 | import { registerUnhandledRejectionHandler } from "./Utils";
6 |
7 | registerUnhandledRejectionHandler();
8 |
9 | describe("AbortSignal", () => {
10 | describe("aborted", () => {
11 | it("is false on initialization", () => {
12 | expect(new AbortController().signal.aborted).toBe(false);
13 | });
14 |
15 | it("is true when aborted", () => {
16 | const controller = new AbortController();
17 | const signal = controller.signal;
18 | controller.abort();
19 | expect(signal.aborted).toBe(true);
20 | });
21 | });
22 |
23 | describe("onabort", () => {
24 | it("is called when abort is called", () => {
25 | const controller = new AbortController();
26 | const signal = controller.signal;
27 | let abortCalled = false;
28 | signal.onabort = () => abortCalled = true;
29 | controller.abort();
30 | expect(abortCalled).toBe(true);
31 | });
32 | });
33 | });
34 |
--------------------------------------------------------------------------------
/wx-demo/miniprogram/app.ts:
--------------------------------------------------------------------------------
1 | //app.ts
2 | export interface IMyApp {
3 | userInfoReadyCallback?(res: WechatMiniprogram.UserInfo): void
4 | globalData: {
5 | userInfo?: WechatMiniprogram.UserInfo
6 | }
7 | }
8 |
9 | App({
10 | onLaunch() {
11 | // 展示本地存储能力
12 | var logs: number[] = wx.getStorageSync('logs') || []
13 | logs.unshift(Date.now())
14 | wx.setStorageSync('logs', logs)
15 |
16 | // 登录
17 | wx.login({
18 | success(_res) {
19 | // console.log(_res.code)
20 | // 发送 _res.code 到后台换取 openId, sessionKey, unionId
21 | }
22 | })
23 | // 获取用户信息
24 | wx.getSetting({
25 | success: (res) => {
26 | if (res.authSetting['scope.userInfo']) {
27 | // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
28 | wx.getUserInfo({
29 | success: res => {
30 | // 可以将 res 发送给后台解码出 unionId
31 | this.globalData.userInfo = res.userInfo
32 | // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
33 | // 所以此处加入 callback 以防止这种情况
34 | if (this.userInfoReadyCallback) {
35 | this.userInfoReadyCallback(res.userInfo)
36 | }
37 | }
38 | })
39 | }
40 | }
41 | })
42 | },
43 | globalData: {
44 | }
45 | })
--------------------------------------------------------------------------------
/FunctionalTests/EchoConnectionHandler.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using System.Buffers;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Connections;
7 |
8 | namespace FunctionalTests
9 | {
10 | public class EchoConnectionHandler : ConnectionHandler
11 | {
12 | public async override Task OnConnectedAsync(ConnectionContext connection)
13 | {
14 | while (true)
15 | {
16 | var result = await connection.Transport.Input.ReadAsync();
17 | var buffer = result.Buffer;
18 |
19 | try
20 | {
21 | if (!buffer.IsEmpty)
22 | {
23 | await connection.Transport.Output.WriteAsync(buffer.ToArray());
24 | }
25 | else if (result.IsCompleted)
26 | {
27 | break;
28 | }
29 | }
30 | finally
31 | {
32 | connection.Transport.Input.AdvanceTo(result.Buffer.End);
33 | }
34 | }
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/signalr/dist/cjs/EmptyNodeHttpClient.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"EmptyNodeHttpClient.js","sourceRoot":"","sources":["../../src/EmptyNodeHttpClient.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;;;;;;;;;;;;;;AAE/G,mIAAmI;AAEnI,2CAAwD;AAGxD;IAAoC,kCAAU;IAC1C,4EAA4E;IAC5E,wBAAmB,MAAe;eAC9B,iBAAO;IACX,CAAC;IAEM,6BAAI,GAAX;QACI,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iIAAiI,CAAC,CAAC,CAAC;IACxK,CAAC;IACL,qBAAC;AAAD,CAAC,AATD,CAAoC,uBAAU,GAS7C;AATY,wCAAc","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// This is an empty implementation of the NodeHttpClient that will be included in browser builds so the output file will be smaller\r\n\r\nimport { HttpClient, HttpResponse } from \"./HttpClient\";\r\nimport { ILogger } from \"./ILogger\";\r\n\r\nexport class NodeHttpClient extends HttpClient {\r\n // @ts-ignore: Need ILogger to compile, but unused variables generate errors\r\n public constructor(logger: ILogger) {\r\n super();\r\n }\r\n\r\n public send(): Promise {\r\n return Promise.reject(new Error(\"If using Node either provide an XmlHttpRequest polyfill or consume the cjs or esm script instead of the browser/signalr.js one.\"));\r\n }\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/dist/esm/EmptyNodeHttpClient.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"EmptyNodeHttpClient.js","sourceRoot":"","sources":["../../src/EmptyNodeHttpClient.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,+GAA+G;;;;;;;;;;;;;;AAE/G,mIAAmI;AAEnI,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AAGxD;IAAoC,kCAAU;IAC1C,4EAA4E;IAC5E,wBAAmB,MAAe;eAC9B,iBAAO;IACX,CAAC;IAEM,6BAAI,GAAX;QACI,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iIAAiI,CAAC,CAAC,CAAC;IACxK,CAAC;IACL,qBAAC;AAAD,CAAC,AATD,CAAoC,UAAU,GAS7C","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// This is an empty implementation of the NodeHttpClient that will be included in browser builds so the output file will be smaller\r\n\r\nimport { HttpClient, HttpResponse } from \"./HttpClient\";\r\nimport { ILogger } from \"./ILogger\";\r\n\r\nexport class NodeHttpClient extends HttpClient {\r\n // @ts-ignore: Need ILogger to compile, but unused variables generate errors\r\n public constructor(logger: ILogger) {\r\n super();\r\n }\r\n\r\n public send(): Promise {\r\n return Promise.reject(new Error(\"If using Node either provide an XmlHttpRequest polyfill or consume the cjs or esm script instead of the browser/signalr.js one.\"));\r\n }\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/dist/cjs/IRetryPolicy.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"IRetryPolicy.js","sourceRoot":"","sources":["../../src/IRetryPolicy.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n/** An abstraction that controls when the client attempts to reconnect and how many times it does so. */\r\nexport interface IRetryPolicy {\r\n /** Called after the transport loses the connection.\r\n *\r\n * @param {RetryContext} retryContext Details related to the retry event to help determine how long to wait for the next retry.\r\n *\r\n * @returns {number | null} The amount of time in milliseconds to wait before the next retry. `null` tells the client to stop retrying.\r\n */\r\n nextRetryDelayInMilliseconds(retryContext: RetryContext): number | null;\r\n}\r\n\r\nexport interface RetryContext {\r\n /**\r\n * The number of consecutive failed tries so far.\r\n */\r\n readonly previousRetryCount: number;\r\n\r\n /**\r\n * The amount of time in milliseconds spent retrying so far.\r\n */\r\n readonly elapsedMilliseconds: number;\r\n\r\n /**\r\n * The error that forced the upcoming retry.\r\n */\r\n readonly retryReason: Error;\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/dist/esm/IRetryPolicy.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"IRetryPolicy.js","sourceRoot":"","sources":["../../src/IRetryPolicy.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,+GAA+G","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n/** An abstraction that controls when the client attempts to reconnect and how many times it does so. */\r\nexport interface IRetryPolicy {\r\n /** Called after the transport loses the connection.\r\n *\r\n * @param {RetryContext} retryContext Details related to the retry event to help determine how long to wait for the next retry.\r\n *\r\n * @returns {number | null} The amount of time in milliseconds to wait before the next retry. `null` tells the client to stop retrying.\r\n */\r\n nextRetryDelayInMilliseconds(retryContext: RetryContext): number | null;\r\n}\r\n\r\nexport interface RetryContext {\r\n /**\r\n * The number of consecutive failed tries so far.\r\n */\r\n readonly previousRetryCount: number;\r\n\r\n /**\r\n * The amount of time in milliseconds spent retrying so far.\r\n */\r\n readonly elapsedMilliseconds: number;\r\n\r\n /**\r\n * The error that forced the upcoming retry.\r\n */\r\n readonly retryReason: Error;\r\n}\r\n"]}
--------------------------------------------------------------------------------
/FunctionalTests/ts/LogBannerReporter.ts:
--------------------------------------------------------------------------------
1 | export class LogBannerReporter implements jasmine.CustomReporter {
2 | private lastTestStarted?: Date;
3 |
4 | public jasmineStarted(): void {
5 | console.log("*** JASMINE SUITE STARTED ***");
6 | }
7 |
8 | public jasmineDone(): void {
9 | console.log("*** JASMINE SUITE FINISHED ***");
10 | }
11 |
12 | public specStarted(result: jasmine.CustomReporterResult): void {
13 | const timestamp = new Date();
14 | this.lastTestStarted = timestamp;
15 | console.log(`*** SPEC STARTED: ${result.fullName} [${timestamp.toISOString()}] ***`);
16 | }
17 |
18 | public specDone(result: jasmine.CustomReporterResult): void {
19 | const timestamp = new Date();
20 |
21 | const duration = this.lastTestStarted ? `${timestamp.getTime() - this.lastTestStarted.getTime()}ms` : "<>";
22 | console.log(`*** SPEC DONE: ${result.fullName} [${timestamp.toISOString()}; Duration: ${duration}] ***`);
23 | }
24 | }
25 |
26 | if (typeof window !== "undefined" && (window as any).customReporterRegistered !== true) {
27 | (window as any).customReporterRegistered = true;
28 | jasmine.getEnv().addReporter(new LogBannerReporter());
29 | } else if (typeof window === "undefined") {
30 | jasmine.getEnv().addReporter(new LogBannerReporter());
31 | }
32 |
--------------------------------------------------------------------------------
/signalr/dist/esm/ILogger.d.ts:
--------------------------------------------------------------------------------
1 | /** Indicates the severity of a log message.
2 | *
3 | * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.
4 | */
5 | export declare enum LogLevel {
6 | /** Log level for very low severity diagnostic messages. */
7 | Trace = 0,
8 | /** Log level for low severity diagnostic messages. */
9 | Debug = 1,
10 | /** Log level for informational diagnostic messages. */
11 | Information = 2,
12 | /** Log level for diagnostic messages that indicate a non-fatal problem. */
13 | Warning = 3,
14 | /** Log level for diagnostic messages that indicate a failure in the current operation. */
15 | Error = 4,
16 | /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */
17 | Critical = 5,
18 | /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */
19 | None = 6
20 | }
21 | /** An abstraction that provides a sink for diagnostic messages. */
22 | export interface ILogger {
23 | /** Called by the framework to emit a diagnostic message.
24 | *
25 | * @param {LogLevel} logLevel The severity level of the message.
26 | * @param {string} message The message.
27 | */
28 | log(logLevel: LogLevel, message: string): void;
29 | }
30 |
--------------------------------------------------------------------------------
/signalr/tests/TextMessageFormat.test.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | import { TextMessageFormat } from "../src/TextMessageFormat";
5 | import { registerUnhandledRejectionHandler } from "./Utils";
6 |
7 | registerUnhandledRejectionHandler();
8 |
9 | describe("TextMessageFormat", () => {
10 | ([
11 | ["\u001e", [""]],
12 | ["\u001e\u001e", ["", ""]],
13 | ["Hello\u001e", ["Hello"]],
14 | ["Hello,\u001eWorld!\u001e", ["Hello,", "World!"]],
15 | ] as Array<[string, string[]]>).forEach(([payload, expectedMessages]) => {
16 | it(`should parse '${encodeURI(payload)}' correctly`, () => {
17 | const messages = TextMessageFormat.parse(payload);
18 | expect(messages).toEqual(expectedMessages);
19 | });
20 | });
21 |
22 | ([
23 | ["", "Message is incomplete."],
24 | ["ABC", "Message is incomplete."],
25 | ["ABC\u001eXYZ", "Message is incomplete."],
26 | ] as Array<[string, string]>).forEach(([payload, expectedError]) => {
27 | it(`should fail to parse '${encodeURI(payload)}'`, () => {
28 | expect(() => TextMessageFormat.parse(payload)).toThrow(expectedError);
29 | });
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/signalr/dist/esm/JsonHubProtocol.d.ts:
--------------------------------------------------------------------------------
1 | import { HubMessage, IHubProtocol } from "./IHubProtocol";
2 | import { ILogger } from "./ILogger";
3 | import { TransferFormat } from "./ITransport";
4 | /** Implements the JSON Hub Protocol. */
5 | export declare class JsonHubProtocol implements IHubProtocol {
6 | /** @inheritDoc */
7 | readonly name: string;
8 | /** @inheritDoc */
9 | readonly version: number;
10 | /** @inheritDoc */
11 | readonly transferFormat: TransferFormat;
12 | /** Creates an array of {@link @microsoft/signalr.HubMessage} objects from the specified serialized representation.
13 | *
14 | * @param {string} input A string containing the serialized representation.
15 | * @param {ILogger} logger A logger that will be used to log messages that occur during parsing.
16 | */
17 | parseMessages(input: string, logger: ILogger): HubMessage[];
18 | /** Writes the specified {@link @microsoft/signalr.HubMessage} to a string and returns it.
19 | *
20 | * @param {HubMessage} message The message to write.
21 | * @returns {string} A string containing the serialized representation of the message.
22 | */
23 | writeMessage(message: HubMessage): string;
24 | private isInvocationMessage;
25 | private isStreamItemMessage;
26 | private isCompletionMessage;
27 | private assertNotEmptyString;
28 | }
29 |
--------------------------------------------------------------------------------
/signalr/src/AbortController.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | // Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController
5 | // We don't actually ever use the API being polyfilled, we always use the polyfill because
6 | // it's a very new API right now.
7 |
8 | // Not exported from index.
9 | /** @private */
10 | export class AbortController implements AbortSignal {
11 | private isAborted: boolean = false;
12 | public onabort: (() => void) | null = null;
13 |
14 | public abort() {
15 | if (!this.isAborted) {
16 | this.isAborted = true;
17 | if (this.onabort) {
18 | this.onabort();
19 | }
20 | }
21 | }
22 |
23 | get signal(): AbortSignal {
24 | return this;
25 | }
26 |
27 | get aborted(): boolean {
28 | return this.isAborted;
29 | }
30 | }
31 |
32 | /** Represents a signal that can be monitored to determine if a request has been aborted. */
33 | export interface AbortSignal {
34 | /** Indicates if the request has been aborted. */
35 | aborted: boolean;
36 | /** Set this to a handler that will be invoked when the request is aborted. */
37 | onabort: (() => void) | null;
38 | }
39 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | "name": ".NET Core Attach",
6 | "type": "coreclr",
7 | "request": "attach",
8 | "processId": "${command:pickProcess}"
9 | },
10 | {
11 | "type": "node",
12 | "request": "attach",
13 | "name": "Node - Attach by Process ID",
14 | "processId": "${command:PickProcess}"
15 | },
16 | {
17 | "type": "node",
18 | "request": "launch",
19 | "name": "Jest - All",
20 | "program": "${workspaceFolder}/common/node_modules/jest/bin/jest",
21 | "cwd": "${workspaceFolder}",
22 | "args": [
23 | "--runInBand"
24 | ],
25 | "console": "integratedTerminal",
26 | "internalConsoleOptions": "neverOpen"
27 | },
28 | {
29 | "type": "node",
30 | "request": "launch",
31 | "name": "Jest - Current File",
32 | "program": "${workspaceFolder}/common/node_modules/jest/bin/jest",
33 | "cwd": "${workspaceFolder}",
34 | "args": [
35 | "${fileBasename}"
36 | ],
37 | "console": "integratedTerminal",
38 | "internalConsoleOptions": "neverOpen"
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/signalr/dist/cjs/DefaultReconnectPolicy.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | var __spreadArrays = (this && this.__spreadArrays) || function () {
5 | for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
6 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
7 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
8 | r[k] = a[j];
9 | return r;
10 | };
11 | Object.defineProperty(exports, "__esModule", { value: true });
12 | // 0, 2, 10, 30 second delays before reconnect attempts.
13 | var DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2000, 10000, 30000, null];
14 | /** @private */
15 | var DefaultReconnectPolicy = /** @class */ (function () {
16 | function DefaultReconnectPolicy(retryDelays) {
17 | this.retryDelays = retryDelays !== undefined ? __spreadArrays(retryDelays, [null]) : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS;
18 | }
19 | DefaultReconnectPolicy.prototype.nextRetryDelayInMilliseconds = function (retryContext) {
20 | return this.retryDelays[retryContext.previousRetryCount];
21 | };
22 | return DefaultReconnectPolicy;
23 | }());
24 | exports.DefaultReconnectPolicy = DefaultReconnectPolicy;
25 | //# sourceMappingURL=DefaultReconnectPolicy.js.map
--------------------------------------------------------------------------------
/signalr/dist/esm/DefaultReconnectPolicy.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"DefaultReconnectPolicy.js","sourceRoot":"","sources":["../../src/DefaultReconnectPolicy.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,+GAA+G;;;;;;;;AAI/G,wDAAwD;AACxD,IAAM,oCAAoC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAE3E,eAAe;AACf;IAGI,gCAAY,WAAsB;QAC9B,IAAI,CAAC,WAAW,GAAG,WAAW,KAAK,SAAS,CAAC,CAAC,gBAAK,WAAW,GAAE,IAAI,GAAE,CAAC,CAAC,oCAAoC,CAAC;IACjH,CAAC;IAEM,6DAA4B,GAAnC,UAAoC,YAA0B;QAC1D,OAAO,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;IAC7D,CAAC;IACL,6BAAC;AAAD,CAAC,AAVD,IAUC","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\nimport { IRetryPolicy, RetryContext } from \"./IRetryPolicy\";\r\n\r\n// 0, 2, 10, 30 second delays before reconnect attempts.\r\nconst DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2000, 10000, 30000, null];\r\n\r\n/** @private */\r\nexport class DefaultReconnectPolicy implements IRetryPolicy {\r\n private readonly retryDelays: Array;\r\n\r\n constructor(retryDelays?: number[]) {\r\n this.retryDelays = retryDelays !== undefined ? [...retryDelays, null] : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS;\r\n }\r\n\r\n public nextRetryDelayInMilliseconds(retryContext: RetryContext): number | null {\r\n return this.retryDelays[retryContext.previousRetryCount];\r\n }\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/dist/esm/AbortController.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | // Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController
4 | // We don't actually ever use the API being polyfilled, we always use the polyfill because
5 | // it's a very new API right now.
6 | // Not exported from index.
7 | /** @private */
8 | var AbortController = /** @class */ (function () {
9 | function AbortController() {
10 | this.isAborted = false;
11 | this.onabort = null;
12 | }
13 | AbortController.prototype.abort = function () {
14 | if (!this.isAborted) {
15 | this.isAborted = true;
16 | if (this.onabort) {
17 | this.onabort();
18 | }
19 | }
20 | };
21 | Object.defineProperty(AbortController.prototype, "signal", {
22 | get: function () {
23 | return this;
24 | },
25 | enumerable: true,
26 | configurable: true
27 | });
28 | Object.defineProperty(AbortController.prototype, "aborted", {
29 | get: function () {
30 | return this.isAborted;
31 | },
32 | enumerable: true,
33 | configurable: true
34 | });
35 | return AbortController;
36 | }());
37 | export { AbortController };
38 | //# sourceMappingURL=AbortController.js.map
--------------------------------------------------------------------------------
/wx-demo/miniprogram/pages/index/index.ts:
--------------------------------------------------------------------------------
1 | //index.js
2 | //获取应用实例
3 | //import { IMyApp } from '../../app'
4 | import { HubConnectionBuilder, HubConnection } from 'wechat-app-signalr'
5 | import { parseMessage } from "../../utils/util";
6 |
7 | //const app = getApp()
8 |
9 | Page({
10 | data: {
11 | mesages: [] as any[]
12 | },
13 | onLoad() {
14 | let connection = new HubConnectionBuilder()
15 | .withUrl("http://localhost:5009/echo")
16 | .withAutomaticReconnect()
17 | .build();
18 |
19 | connection.on("Ping", ping => {
20 | let [type, id] = parseMessage(ping);
21 | console.log(`${type} ${id}`);
22 | connection.send("Pong", `pong ${id + 1}`);
23 | })
24 | connection.start()
25 | .catch(e => {
26 | console.log(`连接失败`);
27 | console.log(e);
28 | });
29 |
30 | let xid = 0;
31 | setInterval(()=>{
32 | this.pingServer(connection, xid)
33 | .then(x=>{
34 | xid = x;
35 | });
36 | },3000)
37 |
38 | },
39 | async pingServer(connection:HubConnection, lastId:number){
40 | let pong = await connection.invoke("Ping",`ping ${lastId+1}`) as string;
41 | let [type,id] = parseMessage(pong);
42 | console.log(`${type} ${id}`);
43 | return id;
44 | }
45 | })
46 |
--------------------------------------------------------------------------------
/wx-demo/miniprogram/pages/logs/logs.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | var util_1 = require("../../utils/util");
4 | Page({
5 | data: {
6 | logs: []
7 | },
8 | onLoad: function () {
9 | this.setData({
10 | logs: (wx.getStorageSync('logs') || []).map(function (log) {
11 | return util_1.formatTime(new Date(log));
12 | })
13 | });
14 | },
15 | });
16 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9ncy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImxvZ3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFDQSx5Q0FBNkM7QUFFN0MsSUFBSSxDQUFDO0lBQ0gsSUFBSSxFQUFFO1FBQ0osSUFBSSxFQUFFLEVBQWM7S0FDckI7SUFDRCxNQUFNLEVBQU47UUFDRSxJQUFJLENBQUMsT0FBUSxDQUFDO1lBQ1osSUFBSSxFQUFFLENBQUMsRUFBRSxDQUFDLGNBQWMsQ0FBQyxNQUFNLENBQUMsSUFBSSxFQUFFLENBQUMsQ0FBQyxHQUFHLENBQUMsVUFBQyxHQUFXO2dCQUN0RCxPQUFPLGlCQUFVLENBQUMsSUFBSSxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQTtZQUNsQyxDQUFDLENBQUM7U0FDSCxDQUFDLENBQUE7SUFDSixDQUFDO0NBQ0YsQ0FBQyxDQUFBIiwic291cmNlc0NvbnRlbnQiOlsiLy9sb2dzLmpzXG5pbXBvcnQgeyBmb3JtYXRUaW1lIH0gZnJvbSAnLi4vLi4vdXRpbHMvdXRpbCdcblxuUGFnZSh7XG4gIGRhdGE6IHtcbiAgICBsb2dzOiBbXSBhcyBzdHJpbmdbXVxuICB9LFxuICBvbkxvYWQoKSB7XG4gICAgdGhpcy5zZXREYXRhISh7XG4gICAgICBsb2dzOiAod3guZ2V0U3RvcmFnZVN5bmMoJ2xvZ3MnKSB8fCBbXSkubWFwKChsb2c6IG51bWJlcikgPT4ge1xuICAgICAgICByZXR1cm4gZm9ybWF0VGltZShuZXcgRGF0ZShsb2cpKVxuICAgICAgfSlcbiAgICB9KVxuICB9LFxufSlcbiJdfQ==
--------------------------------------------------------------------------------
/signalr/dist/cjs/DefaultReconnectPolicy.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"DefaultReconnectPolicy.js","sourceRoot":"","sources":["../../src/DefaultReconnectPolicy.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;;;;;;;;AAI/G,wDAAwD;AACxD,IAAM,oCAAoC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AAE3E,eAAe;AACf;IAGI,gCAAY,WAAsB;QAC9B,IAAI,CAAC,WAAW,GAAG,WAAW,KAAK,SAAS,CAAC,CAAC,gBAAK,WAAW,GAAE,IAAI,GAAE,CAAC,CAAC,oCAAoC,CAAC;IACjH,CAAC;IAEM,6DAA4B,GAAnC,UAAoC,YAA0B;QAC1D,OAAO,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;IAC7D,CAAC;IACL,6BAAC;AAAD,CAAC,AAVD,IAUC;AAVY,wDAAsB","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\nimport { IRetryPolicy, RetryContext } from \"./IRetryPolicy\";\r\n\r\n// 0, 2, 10, 30 second delays before reconnect attempts.\r\nconst DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2000, 10000, 30000, null];\r\n\r\n/** @private */\r\nexport class DefaultReconnectPolicy implements IRetryPolicy {\r\n private readonly retryDelays: Array;\r\n\r\n constructor(retryDelays?: number[]) {\r\n this.retryDelays = retryDelays !== undefined ? [...retryDelays, null] : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS;\r\n }\r\n\r\n public nextRetryDelayInMilliseconds(retryContext: RetryContext): number | null {\r\n return this.retryDelays[retryContext.previousRetryCount];\r\n }\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/src/ITransport.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | // This will be treated as a bit flag in the future, so we keep it using power-of-two values.
5 | /** Specifies a specific HTTP transport type. */
6 | export enum HttpTransportType {
7 | /** Specifies no transport preference. */
8 | None = 0,
9 | /** Specifies the WebSockets transport. */
10 | WebSockets = 1,
11 | /** Specifies the Server-Sent Events transport. */
12 | ServerSentEvents = 2,
13 | /** Specifies the Long Polling transport. */
14 | LongPolling = 4,
15 | }
16 |
17 | /** Specifies the transfer format for a connection. */
18 | export enum TransferFormat {
19 | /** Specifies that only text data will be transmitted over the connection. */
20 | Text = 1,
21 | /** Specifies that binary data will be transmitted over the connection. */
22 | Binary = 2,
23 | }
24 |
25 | /** An abstraction over the behavior of transports. This is designed to support the framework and not intended for use by applications. */
26 | export interface ITransport {
27 | connect(url: string, transferFormat: TransferFormat): Promise;
28 | send(data: any): Promise;
29 | stop(): Promise;
30 | onreceive: ((data: string | ArrayBuffer) => void) | null;
31 | onclose: ((error?: Error) => void) | null;
32 | }
33 |
--------------------------------------------------------------------------------
/FunctionalTests/webpack.config.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | const path = require("path");
5 |
6 | module.exports = {
7 | entry: path.resolve(__dirname, "ts", "index.ts"),
8 | mode: "none",
9 | devtool: "source-map",
10 | module: {
11 | rules: [
12 | {
13 | test: /\.ts$/,
14 | use: [
15 | {
16 | loader: "ts-loader",
17 | options: {
18 | configFile: path.resolve(__dirname, "tsconfig.json"),
19 | },
20 | },
21 | ],
22 | exclude: /node_modules/,
23 | }
24 | ]
25 | },
26 | resolveLoader: {
27 | // Special resolution rules for loaders (which are in the 'common' directory)
28 | modules: [ path.resolve(__dirname, "..", "common", "node_modules") ],
29 | },
30 | resolve: {
31 | extensions: [".ts", ".js"]
32 | },
33 | output: {
34 | filename: 'signalr-functional-tests.js',
35 | path: path.resolve(__dirname, "wwwroot", "dist"),
36 | },
37 | externals: {
38 | "@microsoft/signalr": "signalR",
39 | "@microsoft/signalr-protocol-msgpack": "signalR.protocols.msgpack",
40 | "request": "request",
41 | },
42 | };
--------------------------------------------------------------------------------
/signalr/src/Subject.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | import { IStreamResult, IStreamSubscriber, ISubscription } from "./Stream";
5 | import { SubjectSubscription } from "./Utils";
6 |
7 | /** Stream implementation to stream items to the server. */
8 | export class Subject implements IStreamResult {
9 | /** @internal */
10 | public observers: Array>;
11 |
12 | /** @internal */
13 | public cancelCallback?: () => Promise;
14 |
15 | constructor() {
16 | this.observers = [];
17 | }
18 |
19 | public next(item: T): void {
20 | for (const observer of this.observers) {
21 | observer.next(item);
22 | }
23 | }
24 |
25 | public error(err: any): void {
26 | for (const observer of this.observers) {
27 | if (observer.error) {
28 | observer.error(err);
29 | }
30 | }
31 | }
32 |
33 | public complete(): void {
34 | for (const observer of this.observers) {
35 | if (observer.complete) {
36 | observer.complete();
37 | }
38 | }
39 | }
40 |
41 | public subscribe(observer: IStreamSubscriber): ISubscription {
42 | this.observers.push(observer);
43 | return new SubjectSubscription(this, observer);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/signalr/dist/esm/ITransport.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | // This will be treated as a bit flag in the future, so we keep it using power-of-two values.
4 | /** Specifies a specific HTTP transport type. */
5 | export var HttpTransportType;
6 | (function (HttpTransportType) {
7 | /** Specifies no transport preference. */
8 | HttpTransportType[HttpTransportType["None"] = 0] = "None";
9 | /** Specifies the WebSockets transport. */
10 | HttpTransportType[HttpTransportType["WebSockets"] = 1] = "WebSockets";
11 | /** Specifies the Server-Sent Events transport. */
12 | HttpTransportType[HttpTransportType["ServerSentEvents"] = 2] = "ServerSentEvents";
13 | /** Specifies the Long Polling transport. */
14 | HttpTransportType[HttpTransportType["LongPolling"] = 4] = "LongPolling";
15 | })(HttpTransportType || (HttpTransportType = {}));
16 | /** Specifies the transfer format for a connection. */
17 | export var TransferFormat;
18 | (function (TransferFormat) {
19 | /** Specifies that only text data will be transmitted over the connection. */
20 | TransferFormat[TransferFormat["Text"] = 1] = "Text";
21 | /** Specifies that binary data will be transmitted over the connection. */
22 | TransferFormat[TransferFormat["Binary"] = 2] = "Binary";
23 | })(TransferFormat || (TransferFormat = {}));
24 | //# sourceMappingURL=ITransport.js.map
--------------------------------------------------------------------------------
/signalr/dist/esm/Subject.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | import { SubjectSubscription } from "./Utils";
4 | /** Stream implementation to stream items to the server. */
5 | var Subject = /** @class */ (function () {
6 | function Subject() {
7 | this.observers = [];
8 | }
9 | Subject.prototype.next = function (item) {
10 | for (var _i = 0, _a = this.observers; _i < _a.length; _i++) {
11 | var observer = _a[_i];
12 | observer.next(item);
13 | }
14 | };
15 | Subject.prototype.error = function (err) {
16 | for (var _i = 0, _a = this.observers; _i < _a.length; _i++) {
17 | var observer = _a[_i];
18 | if (observer.error) {
19 | observer.error(err);
20 | }
21 | }
22 | };
23 | Subject.prototype.complete = function () {
24 | for (var _i = 0, _a = this.observers; _i < _a.length; _i++) {
25 | var observer = _a[_i];
26 | if (observer.complete) {
27 | observer.complete();
28 | }
29 | }
30 | };
31 | Subject.prototype.subscribe = function (observer) {
32 | this.observers.push(observer);
33 | return new SubjectSubscription(this, observer);
34 | };
35 | return Subject;
36 | }());
37 | export { Subject };
38 | //# sourceMappingURL=Subject.js.map
--------------------------------------------------------------------------------
/signalr/src/browser-index.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | // This is where we add any polyfills we'll need for the browser. It is the entry module for browser-specific builds.
5 |
6 | import "es6-promise/dist/es6-promise.auto.js";
7 |
8 | // Copy from Array.prototype into Uint8Array to polyfill on IE. It's OK because the implementations of indexOf and slice use properties
9 | // that exist on Uint8Array with the same name, and JavaScript is magic.
10 | // We make them 'writable' because the Buffer polyfill messes with it as well.
11 | if (!Uint8Array.prototype.indexOf) {
12 | Object.defineProperty(Uint8Array.prototype, "indexOf", {
13 | value: Array.prototype.indexOf,
14 | writable: true,
15 | });
16 | }
17 | if (!Uint8Array.prototype.slice) {
18 | Object.defineProperty(Uint8Array.prototype, "slice", {
19 | // wrap the slice in Uint8Array so it looks like a Uint8Array.slice call
20 | // tslint:disable-next-line:object-literal-shorthand
21 | value: function(start?: number, end?: number) { return new Uint8Array(Array.prototype.slice.call(this, start, end)); },
22 | writable: true,
23 | });
24 | }
25 | if (!Uint8Array.prototype.forEach) {
26 | Object.defineProperty(Uint8Array.prototype, "forEach", {
27 | value: Array.prototype.forEach,
28 | writable: true,
29 | });
30 | }
31 |
32 | export * from "./index";
33 |
--------------------------------------------------------------------------------
/signalr/dist/esm/browser-index.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | // This is where we add any polyfills we'll need for the browser. It is the entry module for browser-specific builds.
4 | import "es6-promise/dist/es6-promise.auto.js";
5 | // Copy from Array.prototype into Uint8Array to polyfill on IE. It's OK because the implementations of indexOf and slice use properties
6 | // that exist on Uint8Array with the same name, and JavaScript is magic.
7 | // We make them 'writable' because the Buffer polyfill messes with it as well.
8 | if (!Uint8Array.prototype.indexOf) {
9 | Object.defineProperty(Uint8Array.prototype, "indexOf", {
10 | value: Array.prototype.indexOf,
11 | writable: true,
12 | });
13 | }
14 | if (!Uint8Array.prototype.slice) {
15 | Object.defineProperty(Uint8Array.prototype, "slice", {
16 | // wrap the slice in Uint8Array so it looks like a Uint8Array.slice call
17 | // tslint:disable-next-line:object-literal-shorthand
18 | value: function (start, end) { return new Uint8Array(Array.prototype.slice.call(this, start, end)); },
19 | writable: true,
20 | });
21 | }
22 | if (!Uint8Array.prototype.forEach) {
23 | Object.defineProperty(Uint8Array.prototype, "forEach", {
24 | value: Array.prototype.forEach,
25 | writable: true,
26 | });
27 | }
28 | export * from "./index";
29 | //# sourceMappingURL=browser-index.js.map
--------------------------------------------------------------------------------
/FunctionalTests/func.jest.config.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | module.exports = {
5 | transformIgnorePatterns: [
6 | // We reference the ESM output from tests and don't want to run them through jest as it won't understand the syntax
7 | ".*/node_modules/(?!@microsoft)"
8 | ],
9 | globals: {
10 | "ts-jest": {
11 | "tsConfig": "./tsconfig.jest.json",
12 | "babelConfig": true,
13 |
14 | // Needed in order to properly process the JS files
15 | // We run 'tsc --noEmit' to get TS diagnostics before the test instead
16 | "diagnostics": false,
17 | }
18 | },
19 | reporters: [
20 | "default",
21 | ["../common/node_modules/jest-junit/index.js", { "output": "../../../../../artifacts/log/" + `${process.platform}` + ".node.functional.junit.xml" }]
22 | ],
23 | transform: {
24 | "^.+\\.(jsx?|tsx?)$": "../common/node_modules/ts-jest"
25 | },
26 | testEnvironment: "node",
27 | testRegex: "(Tests)\\.(jsx?|tsx?)$",
28 | moduleNameMapper: {
29 | "^ts-jest$": "/../common/node_modules/ts-jest",
30 | "^@microsoft/signalr$": "/../signalr/dist/cjs/index.js"
31 | },
32 | moduleFileExtensions: [
33 | "ts",
34 | "tsx",
35 | "js",
36 | "jsx",
37 | "json",
38 | "node"
39 | ]
40 | };
41 |
--------------------------------------------------------------------------------
/signalr/dist/cjs/AbortController.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | Object.defineProperty(exports, "__esModule", { value: true });
5 | // Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController
6 | // We don't actually ever use the API being polyfilled, we always use the polyfill because
7 | // it's a very new API right now.
8 | // Not exported from index.
9 | /** @private */
10 | var AbortController = /** @class */ (function () {
11 | function AbortController() {
12 | this.isAborted = false;
13 | this.onabort = null;
14 | }
15 | AbortController.prototype.abort = function () {
16 | if (!this.isAborted) {
17 | this.isAborted = true;
18 | if (this.onabort) {
19 | this.onabort();
20 | }
21 | }
22 | };
23 | Object.defineProperty(AbortController.prototype, "signal", {
24 | get: function () {
25 | return this;
26 | },
27 | enumerable: true,
28 | configurable: true
29 | });
30 | Object.defineProperty(AbortController.prototype, "aborted", {
31 | get: function () {
32 | return this.isAborted;
33 | },
34 | enumerable: true,
35 | configurable: true
36 | });
37 | return AbortController;
38 | }());
39 | exports.AbortController = AbortController;
40 | //# sourceMappingURL=AbortController.js.map
--------------------------------------------------------------------------------
/signalr/dist/esm/ILogger.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | // These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.
4 | /** Indicates the severity of a log message.
5 | *
6 | * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.
7 | */
8 | export var LogLevel;
9 | (function (LogLevel) {
10 | /** Log level for very low severity diagnostic messages. */
11 | LogLevel[LogLevel["Trace"] = 0] = "Trace";
12 | /** Log level for low severity diagnostic messages. */
13 | LogLevel[LogLevel["Debug"] = 1] = "Debug";
14 | /** Log level for informational diagnostic messages. */
15 | LogLevel[LogLevel["Information"] = 2] = "Information";
16 | /** Log level for diagnostic messages that indicate a non-fatal problem. */
17 | LogLevel[LogLevel["Warning"] = 3] = "Warning";
18 | /** Log level for diagnostic messages that indicate a failure in the current operation. */
19 | LogLevel[LogLevel["Error"] = 4] = "Error";
20 | /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */
21 | LogLevel[LogLevel["Critical"] = 5] = "Critical";
22 | /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */
23 | LogLevel[LogLevel["None"] = 6] = "None";
24 | })(LogLevel || (LogLevel = {}));
25 | //# sourceMappingURL=ILogger.js.map
--------------------------------------------------------------------------------
/EchoServer/Startup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using EchoServer.Hubs;
6 | using Microsoft.AspNetCore.Builder;
7 | using Microsoft.AspNetCore.Hosting;
8 | using Microsoft.AspNetCore.Http;
9 | using Microsoft.Extensions.DependencyInjection;
10 | using Microsoft.Extensions.Hosting;
11 |
12 | namespace EchoServer
13 | {
14 | public class Startup
15 | {
16 | // This method gets called by the runtime. Use this method to add services to the container.
17 | // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
18 | public void ConfigureServices(IServiceCollection services)
19 | {
20 | services.AddSignalR();
21 | }
22 |
23 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
24 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
25 | {
26 | if (env.IsDevelopment())
27 | {
28 | app.UseDeveloperExceptionPage();
29 | }
30 |
31 | app.UseRouting();
32 |
33 | app.UseEndpoints(endpoints =>
34 | {
35 | endpoints.MapGet("/", async context =>
36 | {
37 | await context.Response.WriteAsync("connected to /echo to connect to the signalr");
38 | });
39 | endpoints.MapHub("/echo");
40 | });
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/signalr/dist/cjs/Subject.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | Object.defineProperty(exports, "__esModule", { value: true });
5 | var Utils_1 = require("./Utils");
6 | /** Stream implementation to stream items to the server. */
7 | var Subject = /** @class */ (function () {
8 | function Subject() {
9 | this.observers = [];
10 | }
11 | Subject.prototype.next = function (item) {
12 | for (var _i = 0, _a = this.observers; _i < _a.length; _i++) {
13 | var observer = _a[_i];
14 | observer.next(item);
15 | }
16 | };
17 | Subject.prototype.error = function (err) {
18 | for (var _i = 0, _a = this.observers; _i < _a.length; _i++) {
19 | var observer = _a[_i];
20 | if (observer.error) {
21 | observer.error(err);
22 | }
23 | }
24 | };
25 | Subject.prototype.complete = function () {
26 | for (var _i = 0, _a = this.observers; _i < _a.length; _i++) {
27 | var observer = _a[_i];
28 | if (observer.complete) {
29 | observer.complete();
30 | }
31 | }
32 | };
33 | Subject.prototype.subscribe = function (observer) {
34 | this.observers.push(observer);
35 | return new Utils_1.SubjectSubscription(this, observer);
36 | };
37 | return Subject;
38 | }());
39 | exports.Subject = Subject;
40 | //# sourceMappingURL=Subject.js.map
--------------------------------------------------------------------------------
/signalr/src/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | // Version token that will be replaced by the prepack command
5 | /** The version of the SignalR client. */
6 | export const VERSION: string = "0.0.0-DEV_BUILD";
7 |
8 | // Everything that users need to access must be exported here. Including interfaces.
9 | export { AbortSignal } from "./AbortController";
10 | export { AbortError, HttpError, TimeoutError } from "./Errors";
11 | export { HttpClient, HttpRequest, HttpResponse } from "./HttpClient";
12 | export { DefaultHttpClient } from "./DefaultHttpClient";
13 | export { IHttpConnectionOptions } from "./IHttpConnectionOptions";
14 | export { HubConnection, HubConnectionState } from "./HubConnection";
15 | export { HubConnectionBuilder } from "./HubConnectionBuilder";
16 | export { MessageType, MessageHeaders, HubMessage, HubMessageBase, HubInvocationMessage, InvocationMessage, StreamInvocationMessage, StreamItemMessage, CompletionMessage,
17 | PingMessage, CloseMessage, CancelInvocationMessage, IHubProtocol } from "./IHubProtocol";
18 | export { ILogger, LogLevel } from "./ILogger";
19 | export { HttpTransportType, TransferFormat, ITransport } from "./ITransport";
20 | export { IStreamSubscriber, IStreamResult, ISubscription } from "./Stream";
21 | export { NullLogger } from "./Loggers";
22 | export { JsonHubProtocol } from "./JsonHubProtocol";
23 | export { Subject } from "./Subject";
24 | export { IRetryPolicy, RetryContext } from "./IRetryPolicy";
25 |
--------------------------------------------------------------------------------
/EchoServer/Hubs/EchoHub.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using Microsoft.AspNetCore.SignalR;
4 |
5 | namespace EchoServer.Hubs
6 | {
7 | public class EchoHub : Hub
8 | {
9 | public override async Task OnConnectedAsync()
10 | {
11 | await Clients.Caller.Ping("ping 0");
12 | }
13 | public Task Ping(string ping)
14 | {
15 | (var type, var id) = ParseMessage(ping);
16 |
17 | return Task.FromResult($"pong {id}");
18 | }
19 |
20 | public async Task Pong(string pong)
21 | {
22 | (var type, var id) = ParseMessage(pong);
23 | await Task.Delay(3000);
24 | await Clients.Caller.Ping($"ping {id + 1}");
25 | }
26 |
27 | private (string type, int id) ParseMessage(string message)
28 | {
29 | message = message ?? throw new ArgumentNullException(nameof(message));
30 | var arr = message.Split(' ');
31 | if (arr.Length != 2)
32 | {
33 | throw new ArgumentOutOfRangeException($"ping/pong message is not valid: {message}");
34 | }
35 | var p = arr[0];
36 | var idstr = arr[1];
37 | if (int.TryParse(idstr, out var id))
38 | {
39 | id++;
40 | }
41 | else
42 | {
43 | throw new ArgumentOutOfRangeException($"can not get id from message:{idstr}| {message}");
44 | }
45 |
46 | return (p, id);
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/signalr/dist/esm/TextMessageFormat.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"TextMessageFormat.js","sourceRoot":"","sources":["../../src/TextMessageFormat.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,+GAA+G;AAE/G,0BAA0B;AAC1B,eAAe;AACf;IAAA;IAiBA,CAAC;IAbiB,uBAAK,GAAnB,UAAoB,MAAc;QAC9B,OAAO,KAAG,MAAM,GAAG,iBAAiB,CAAC,eAAiB,CAAC;IAC3D,CAAC;IAEa,uBAAK,GAAnB,UAAoB,KAAa;QAC7B,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,iBAAiB,CAAC,eAAe,EAAE;YAC/D,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC7C;QAED,IAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;QAChE,QAAQ,CAAC,GAAG,EAAE,CAAC;QACf,OAAO,QAAQ,CAAC;IACpB,CAAC;IAfa,qCAAmB,GAAG,IAAI,CAAC;IAC3B,iCAAe,GAAG,MAAM,CAAC,YAAY,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IAe/F,wBAAC;CAAA,AAjBD,IAiBC;SAjBY,iBAAiB","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// Not exported from index\r\n/** @private */\r\nexport class TextMessageFormat {\r\n public static RecordSeparatorCode = 0x1e;\r\n public static RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);\r\n\r\n public static write(output: string): string {\r\n return `${output}${TextMessageFormat.RecordSeparator}`;\r\n }\r\n\r\n public static parse(input: string): string[] {\r\n if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n\r\n const messages = input.split(TextMessageFormat.RecordSeparator);\r\n messages.pop();\r\n return messages;\r\n }\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/dist/cjs/TextMessageFormat.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"TextMessageFormat.js","sourceRoot":"","sources":["../../src/TextMessageFormat.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;AAE/G,0BAA0B;AAC1B,eAAe;AACf;IAAA;IAiBA,CAAC;IAbiB,uBAAK,GAAnB,UAAoB,MAAc;QAC9B,OAAO,KAAG,MAAM,GAAG,iBAAiB,CAAC,eAAiB,CAAC;IAC3D,CAAC;IAEa,uBAAK,GAAnB,UAAoB,KAAa;QAC7B,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,iBAAiB,CAAC,eAAe,EAAE;YAC/D,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC7C;QAED,IAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;QAChE,QAAQ,CAAC,GAAG,EAAE,CAAC;QACf,OAAO,QAAQ,CAAC;IACpB,CAAC;IAfa,qCAAmB,GAAG,IAAI,CAAC;IAC3B,iCAAe,GAAG,MAAM,CAAC,YAAY,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IAe/F,wBAAC;CAAA,AAjBD,IAiBC;AAjBY,8CAAiB","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// Not exported from index\r\n/** @private */\r\nexport class TextMessageFormat {\r\n public static RecordSeparatorCode = 0x1e;\r\n public static RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);\r\n\r\n public static write(output: string): string {\r\n return `${output}${TextMessageFormat.RecordSeparator}`;\r\n }\r\n\r\n public static parse(input: string): string[] {\r\n if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n\r\n const messages = input.split(TextMessageFormat.RecordSeparator);\r\n messages.pop();\r\n return messages;\r\n }\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/dist/cjs/ITransport.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | Object.defineProperty(exports, "__esModule", { value: true });
5 | // This will be treated as a bit flag in the future, so we keep it using power-of-two values.
6 | /** Specifies a specific HTTP transport type. */
7 | var HttpTransportType;
8 | (function (HttpTransportType) {
9 | /** Specifies no transport preference. */
10 | HttpTransportType[HttpTransportType["None"] = 0] = "None";
11 | /** Specifies the WebSockets transport. */
12 | HttpTransportType[HttpTransportType["WebSockets"] = 1] = "WebSockets";
13 | /** Specifies the Server-Sent Events transport. */
14 | HttpTransportType[HttpTransportType["ServerSentEvents"] = 2] = "ServerSentEvents";
15 | /** Specifies the Long Polling transport. */
16 | HttpTransportType[HttpTransportType["LongPolling"] = 4] = "LongPolling";
17 | })(HttpTransportType = exports.HttpTransportType || (exports.HttpTransportType = {}));
18 | /** Specifies the transfer format for a connection. */
19 | var TransferFormat;
20 | (function (TransferFormat) {
21 | /** Specifies that only text data will be transmitted over the connection. */
22 | TransferFormat[TransferFormat["Text"] = 1] = "Text";
23 | /** Specifies that binary data will be transmitted over the connection. */
24 | TransferFormat[TransferFormat["Binary"] = 2] = "Binary";
25 | })(TransferFormat = exports.TransferFormat || (exports.TransferFormat = {}));
26 | //# sourceMappingURL=ITransport.js.map
--------------------------------------------------------------------------------
/signalr/src/ILogger.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | // These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.
5 | /** Indicates the severity of a log message.
6 | *
7 | * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.
8 | */
9 | export enum LogLevel {
10 | /** Log level for very low severity diagnostic messages. */
11 | Trace = 0,
12 | /** Log level for low severity diagnostic messages. */
13 | Debug = 1,
14 | /** Log level for informational diagnostic messages. */
15 | Information = 2,
16 | /** Log level for diagnostic messages that indicate a non-fatal problem. */
17 | Warning = 3,
18 | /** Log level for diagnostic messages that indicate a failure in the current operation. */
19 | Error = 4,
20 | /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */
21 | Critical = 5,
22 | /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */
23 | None = 6,
24 | }
25 |
26 | /** An abstraction that provides a sink for diagnostic messages. */
27 | export interface ILogger {
28 | /** Called by the framework to emit a diagnostic message.
29 | *
30 | * @param {LogLevel} logLevel The severity level of the message.
31 | * @param {string} message The message.
32 | */
33 | log(logLevel: LogLevel, message: string): void;
34 | }
35 |
--------------------------------------------------------------------------------
/signalr/dist/esm/EmptyNodeHttpClient.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | var __extends = (this && this.__extends) || (function () {
4 | var extendStatics = function (d, b) {
5 | extendStatics = Object.setPrototypeOf ||
6 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
8 | return extendStatics(d, b);
9 | };
10 | return function (d, b) {
11 | extendStatics(d, b);
12 | function __() { this.constructor = d; }
13 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14 | };
15 | })();
16 | // This is an empty implementation of the NodeHttpClient that will be included in browser builds so the output file will be smaller
17 | import { HttpClient } from "./HttpClient";
18 | var NodeHttpClient = /** @class */ (function (_super) {
19 | __extends(NodeHttpClient, _super);
20 | // @ts-ignore: Need ILogger to compile, but unused variables generate errors
21 | function NodeHttpClient(logger) {
22 | return _super.call(this) || this;
23 | }
24 | NodeHttpClient.prototype.send = function () {
25 | return Promise.reject(new Error("If using Node either provide an XmlHttpRequest polyfill or consume the cjs or esm script instead of the browser/signalr.js one."));
26 | };
27 | return NodeHttpClient;
28 | }(HttpClient));
29 | export { NodeHttpClient };
30 | //# sourceMappingURL=EmptyNodeHttpClient.js.map
--------------------------------------------------------------------------------
/signalr/dist/cjs/ILogger.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | Object.defineProperty(exports, "__esModule", { value: true });
5 | // These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.
6 | /** Indicates the severity of a log message.
7 | *
8 | * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.
9 | */
10 | var LogLevel;
11 | (function (LogLevel) {
12 | /** Log level for very low severity diagnostic messages. */
13 | LogLevel[LogLevel["Trace"] = 0] = "Trace";
14 | /** Log level for low severity diagnostic messages. */
15 | LogLevel[LogLevel["Debug"] = 1] = "Debug";
16 | /** Log level for informational diagnostic messages. */
17 | LogLevel[LogLevel["Information"] = 2] = "Information";
18 | /** Log level for diagnostic messages that indicate a non-fatal problem. */
19 | LogLevel[LogLevel["Warning"] = 3] = "Warning";
20 | /** Log level for diagnostic messages that indicate a failure in the current operation. */
21 | LogLevel[LogLevel["Error"] = 4] = "Error";
22 | /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */
23 | LogLevel[LogLevel["Critical"] = 5] = "Critical";
24 | /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */
25 | LogLevel[LogLevel["None"] = 6] = "None";
26 | })(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
27 | //# sourceMappingURL=ILogger.js.map
--------------------------------------------------------------------------------
/signalr/src/third-party-notices.txt:
--------------------------------------------------------------------------------
1 | .NET Core uses third-party libraries or other resources that may be
2 | distributed under licenses different than the .NET Core software.
3 |
4 | In the event that we accidentally failed to list a required notice, please
5 | bring it to our attention. Post an issue or email us:
6 |
7 | dotnet@microsoft.com
8 |
9 | The attached notices are provided for information only.
10 |
11 |
12 | License notice for es6-promise
13 | ------------------------------------------------------------------------------
14 | "Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors
15 |
16 | Permission is hereby granted, free of charge, to any person obtaining a copy of
17 | this software and associated documentation files (the "Software"), to deal in
18 | the Software without restriction, including without limitation the rights to
19 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
20 | of the Software, and to permit persons to whom the Software is furnished to do
21 | so, subject to the following conditions:
22 |
23 | The above copyright notice and this permission notice shall be included in all
24 | copies or substantial portions of the Software.
25 |
26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 | SOFTWARE."
--------------------------------------------------------------------------------
/FunctionalTests/ts/WebSocketTests.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | import { ECHOENDPOINT_URL } from "./Common";
5 | import "./LogBannerReporter";
6 |
7 | describe("WebSockets", () => {
8 | it("can be used to connect to SignalR", (done) => {
9 | const message = "message";
10 |
11 | let webSocket: WebSocket;
12 | if (typeof window !== "undefined") {
13 | if (typeof WebSocket !== "undefined") {
14 | webSocket = new WebSocket(ECHOENDPOINT_URL.replace(/^http/, "ws"));
15 | } else {
16 | // Running in a browser that doesn't support WebSockets
17 | done();
18 | return;
19 | }
20 | } else {
21 | const websocketModule = require("ws");
22 | if (websocketModule) {
23 | webSocket = new websocketModule(ECHOENDPOINT_URL.replace(/^http/, "ws"));
24 | } else {
25 | // No WebSockets implementations in current environment, skip test
26 | done();
27 | return;
28 | }
29 | }
30 |
31 | webSocket.onopen = () => {
32 | webSocket.send(message);
33 | };
34 |
35 | webSocket.onmessage = (event) => {
36 | expect(event.data).toEqual(message);
37 | webSocket.close();
38 | };
39 |
40 | webSocket.onclose = (event) => {
41 | expect(event.code).toEqual(1000);
42 | expect(event.wasClean).toBe(true);
43 |
44 | done();
45 | };
46 | });
47 | });
48 |
--------------------------------------------------------------------------------
/signalr/dist/cjs/browser-index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | function __export(m) {
5 | for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
6 | }
7 | Object.defineProperty(exports, "__esModule", { value: true });
8 | // This is where we add any polyfills we'll need for the browser. It is the entry module for browser-specific builds.
9 | require("es6-promise/dist/es6-promise.auto.js");
10 | // Copy from Array.prototype into Uint8Array to polyfill on IE. It's OK because the implementations of indexOf and slice use properties
11 | // that exist on Uint8Array with the same name, and JavaScript is magic.
12 | // We make them 'writable' because the Buffer polyfill messes with it as well.
13 | if (!Uint8Array.prototype.indexOf) {
14 | Object.defineProperty(Uint8Array.prototype, "indexOf", {
15 | value: Array.prototype.indexOf,
16 | writable: true,
17 | });
18 | }
19 | if (!Uint8Array.prototype.slice) {
20 | Object.defineProperty(Uint8Array.prototype, "slice", {
21 | // wrap the slice in Uint8Array so it looks like a Uint8Array.slice call
22 | // tslint:disable-next-line:object-literal-shorthand
23 | value: function (start, end) { return new Uint8Array(Array.prototype.slice.call(this, start, end)); },
24 | writable: true,
25 | });
26 | }
27 | if (!Uint8Array.prototype.forEach) {
28 | Object.defineProperty(Uint8Array.prototype, "forEach", {
29 | value: Array.prototype.forEach,
30 | writable: true,
31 | });
32 | }
33 | __export(require("./index"));
34 | //# sourceMappingURL=browser-index.js.map
--------------------------------------------------------------------------------
/signalr/dist/cjs/EmptyNodeHttpClient.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | var __extends = (this && this.__extends) || (function () {
5 | var extendStatics = function (d, b) {
6 | extendStatics = Object.setPrototypeOf ||
7 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
9 | return extendStatics(d, b);
10 | };
11 | return function (d, b) {
12 | extendStatics(d, b);
13 | function __() { this.constructor = d; }
14 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15 | };
16 | })();
17 | Object.defineProperty(exports, "__esModule", { value: true });
18 | // This is an empty implementation of the NodeHttpClient that will be included in browser builds so the output file will be smaller
19 | var HttpClient_1 = require("./HttpClient");
20 | var NodeHttpClient = /** @class */ (function (_super) {
21 | __extends(NodeHttpClient, _super);
22 | // @ts-ignore: Need ILogger to compile, but unused variables generate errors
23 | function NodeHttpClient(logger) {
24 | return _super.call(this) || this;
25 | }
26 | NodeHttpClient.prototype.send = function () {
27 | return Promise.reject(new Error("If using Node either provide an XmlHttpRequest polyfill or consume the cjs or esm script instead of the browser/signalr.js one."));
28 | };
29 | return NodeHttpClient;
30 | }(HttpClient_1.HttpClient));
31 | exports.NodeHttpClient = NodeHttpClient;
32 | //# sourceMappingURL=EmptyNodeHttpClient.js.map
--------------------------------------------------------------------------------
/signalr/dist/esm/IHubProtocol.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 | /** Defines the type of a Hub Message. */
4 | export var MessageType;
5 | (function (MessageType) {
6 | /** Indicates the message is an Invocation message and implements the {@link @microsoft/signalr.InvocationMessage} interface. */
7 | MessageType[MessageType["Invocation"] = 1] = "Invocation";
8 | /** Indicates the message is a StreamItem message and implements the {@link @microsoft/signalr.StreamItemMessage} interface. */
9 | MessageType[MessageType["StreamItem"] = 2] = "StreamItem";
10 | /** Indicates the message is a Completion message and implements the {@link @microsoft/signalr.CompletionMessage} interface. */
11 | MessageType[MessageType["Completion"] = 3] = "Completion";
12 | /** Indicates the message is a Stream Invocation message and implements the {@link @microsoft/signalr.StreamInvocationMessage} interface. */
13 | MessageType[MessageType["StreamInvocation"] = 4] = "StreamInvocation";
14 | /** Indicates the message is a Cancel Invocation message and implements the {@link @microsoft/signalr.CancelInvocationMessage} interface. */
15 | MessageType[MessageType["CancelInvocation"] = 5] = "CancelInvocation";
16 | /** Indicates the message is a Ping message and implements the {@link @microsoft/signalr.PingMessage} interface. */
17 | MessageType[MessageType["Ping"] = 6] = "Ping";
18 | /** Indicates the message is a Close message and implements the {@link @microsoft/signalr.CloseMessage} interface. */
19 | MessageType[MessageType["Close"] = 7] = "Close";
20 | })(MessageType || (MessageType = {}));
21 | //# sourceMappingURL=IHubProtocol.js.map
--------------------------------------------------------------------------------
/FunctionalTests/wwwroot/default.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | SignalR Client End-to-End tests
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/FunctionalTests/ts/TestLogger.ts:
--------------------------------------------------------------------------------
1 | import { ILogger, LogLevel } from "@microsoft/signalr";
2 |
3 | // Since JavaScript modules are file-based, we can just pull in utilities from the
4 | // main library directly even if they aren't exported.
5 | import { ConsoleLogger } from "@microsoft/signalr/dist/esm/Utils";
6 |
7 | export class TestLog {
8 | public messages: Array<[Date, LogLevel, string]> = [];
9 |
10 | public addMessage(timestamp: Date, logLevel: LogLevel, message: string): void {
11 | this.messages.push([timestamp, logLevel, message]);
12 | }
13 |
14 | public getLog(): string {
15 | // Dump the logs to a string
16 | let str = "";
17 | for (const [timestamp, level, message] of this.messages) {
18 | str += `[${timestamp.toISOString()}] ${LogLevel[level]}: ${message}\r\n`;
19 | }
20 |
21 | return str;
22 | }
23 |
24 | public getLogUrl(): string {
25 | const log = this.getLog();
26 | return `data:text/plain;base64,${escape(btoa(log))}`;
27 | }
28 |
29 | public open(): void {
30 | window.open(this.getLogUrl());
31 | }
32 | }
33 |
34 | export class TestLogger implements ILogger {
35 | public static instance: TestLogger = new TestLogger();
36 | private static consoleLogger: ConsoleLogger = new ConsoleLogger(LogLevel.Trace);
37 |
38 | public currentLog: TestLog = new TestLog();
39 |
40 | public log(logLevel: LogLevel, message: string): void {
41 | this.currentLog.addMessage(new Date(), logLevel, message);
42 |
43 | // Also write to browser console
44 | TestLogger.consoleLogger.log(logLevel, message);
45 | }
46 |
47 | public static saveLogsAndReset(): TestLog {
48 | const currentLog = TestLogger.instance.currentLog;
49 | TestLogger.instance.currentLog = new TestLog();
50 | return currentLog;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/signalr/dist/cjs/IHubProtocol.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | Object.defineProperty(exports, "__esModule", { value: true });
5 | /** Defines the type of a Hub Message. */
6 | var MessageType;
7 | (function (MessageType) {
8 | /** Indicates the message is an Invocation message and implements the {@link @microsoft/signalr.InvocationMessage} interface. */
9 | MessageType[MessageType["Invocation"] = 1] = "Invocation";
10 | /** Indicates the message is a StreamItem message and implements the {@link @microsoft/signalr.StreamItemMessage} interface. */
11 | MessageType[MessageType["StreamItem"] = 2] = "StreamItem";
12 | /** Indicates the message is a Completion message and implements the {@link @microsoft/signalr.CompletionMessage} interface. */
13 | MessageType[MessageType["Completion"] = 3] = "Completion";
14 | /** Indicates the message is a Stream Invocation message and implements the {@link @microsoft/signalr.StreamInvocationMessage} interface. */
15 | MessageType[MessageType["StreamInvocation"] = 4] = "StreamInvocation";
16 | /** Indicates the message is a Cancel Invocation message and implements the {@link @microsoft/signalr.CancelInvocationMessage} interface. */
17 | MessageType[MessageType["CancelInvocation"] = 5] = "CancelInvocation";
18 | /** Indicates the message is a Ping message and implements the {@link @microsoft/signalr.PingMessage} interface. */
19 | MessageType[MessageType["Ping"] = 6] = "Ping";
20 | /** Indicates the message is a Close message and implements the {@link @microsoft/signalr.CloseMessage} interface. */
21 | MessageType[MessageType["Close"] = 7] = "Close";
22 | })(MessageType = exports.MessageType || (exports.MessageType = {}));
23 | //# sourceMappingURL=IHubProtocol.js.map
--------------------------------------------------------------------------------
/signalr/dist/cjs/index.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | Object.defineProperty(exports, "__esModule", { value: true });
5 | // Version token that will be replaced by the prepack command
6 | /** The version of the SignalR client. */
7 | exports.VERSION = "0.0.0-DEV_BUILD";
8 | var Errors_1 = require("./Errors");
9 | exports.AbortError = Errors_1.AbortError;
10 | exports.HttpError = Errors_1.HttpError;
11 | exports.TimeoutError = Errors_1.TimeoutError;
12 | var HttpClient_1 = require("./HttpClient");
13 | exports.HttpClient = HttpClient_1.HttpClient;
14 | exports.HttpResponse = HttpClient_1.HttpResponse;
15 | var DefaultHttpClient_1 = require("./DefaultHttpClient");
16 | exports.DefaultHttpClient = DefaultHttpClient_1.DefaultHttpClient;
17 | var HubConnection_1 = require("./HubConnection");
18 | exports.HubConnection = HubConnection_1.HubConnection;
19 | exports.HubConnectionState = HubConnection_1.HubConnectionState;
20 | var HubConnectionBuilder_1 = require("./HubConnectionBuilder");
21 | exports.HubConnectionBuilder = HubConnectionBuilder_1.HubConnectionBuilder;
22 | var IHubProtocol_1 = require("./IHubProtocol");
23 | exports.MessageType = IHubProtocol_1.MessageType;
24 | var ILogger_1 = require("./ILogger");
25 | exports.LogLevel = ILogger_1.LogLevel;
26 | var ITransport_1 = require("./ITransport");
27 | exports.HttpTransportType = ITransport_1.HttpTransportType;
28 | exports.TransferFormat = ITransport_1.TransferFormat;
29 | var Loggers_1 = require("./Loggers");
30 | exports.NullLogger = Loggers_1.NullLogger;
31 | var JsonHubProtocol_1 = require("./JsonHubProtocol");
32 | exports.JsonHubProtocol = JsonHubProtocol_1.JsonHubProtocol;
33 | var Subject_1 = require("./Subject");
34 | exports.Subject = Subject_1.Subject;
35 | //# sourceMappingURL=index.js.map
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/dist/esm/MessagePackHubProtocol.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | import { HubMessage, IHubProtocol, ILogger, TransferFormat } from "@microsoft/signalr";
3 | /** Implements the MessagePack Hub Protocol */
4 | export declare class MessagePackHubProtocol implements IHubProtocol {
5 | /** The name of the protocol. This is used by SignalR to resolve the protocol between the client and server. */
6 | readonly name: string;
7 | /** The version of the protocol. */
8 | readonly version: number;
9 | /** The TransferFormat of the protocol. */
10 | readonly transferFormat: TransferFormat;
11 | private readonly errorResult;
12 | private readonly voidResult;
13 | private readonly nonVoidResult;
14 | /** Creates an array of HubMessage objects from the specified serialized representation.
15 | *
16 | * @param {ArrayBuffer | Buffer} input An ArrayBuffer or Buffer containing the serialized representation.
17 | * @param {ILogger} logger A logger that will be used to log messages that occur during parsing.
18 | */
19 | parseMessages(input: ArrayBuffer | Buffer, logger: ILogger): HubMessage[];
20 | /** Writes the specified HubMessage to an ArrayBuffer and returns it.
21 | *
22 | * @param {HubMessage} message The message to write.
23 | * @returns {ArrayBuffer} An ArrayBuffer containing the serialized representation of the message.
24 | */
25 | writeMessage(message: HubMessage): ArrayBuffer;
26 | private parseMessage;
27 | private createCloseMessage;
28 | private createPingMessage;
29 | private createInvocationMessage;
30 | private createStreamItemMessage;
31 | private createCompletionMessage;
32 | private writeInvocation;
33 | private writeStreamInvocation;
34 | private writeStreamItem;
35 | private writeCompletion;
36 | private writeCancelInvocation;
37 | private readHeaders;
38 | }
39 |
--------------------------------------------------------------------------------
/signalr/dist/esm/ITransport.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"ITransport.js","sourceRoot":"","sources":["../../src/ITransport.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,+GAA+G;AAE/G,6FAA6F;AAC7F,gDAAgD;AAChD,MAAM,CAAN,IAAY,iBASX;AATD,WAAY,iBAAiB;IACzB,yCAAyC;IACzC,yDAAQ,CAAA;IACR,0CAA0C;IAC1C,qEAAc,CAAA;IACd,kDAAkD;IAClD,iFAAoB,CAAA;IACpB,4CAA4C;IAC5C,uEAAe,CAAA;AACnB,CAAC,EATW,iBAAiB,KAAjB,iBAAiB,QAS5B;AAED,sDAAsD;AACtD,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACtB,6EAA6E;IAC7E,mDAAQ,CAAA;IACR,0EAA0E;IAC1E,uDAAU,CAAA;AACd,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// This will be treated as a bit flag in the future, so we keep it using power-of-two values.\r\n/** Specifies a specific HTTP transport type. */\r\nexport enum HttpTransportType {\r\n /** Specifies no transport preference. */\r\n None = 0,\r\n /** Specifies the WebSockets transport. */\r\n WebSockets = 1,\r\n /** Specifies the Server-Sent Events transport. */\r\n ServerSentEvents = 2,\r\n /** Specifies the Long Polling transport. */\r\n LongPolling = 4,\r\n}\r\n\r\n/** Specifies the transfer format for a connection. */\r\nexport enum TransferFormat {\r\n /** Specifies that only text data will be transmitted over the connection. */\r\n Text = 1,\r\n /** Specifies that binary data will be transmitted over the connection. */\r\n Binary = 2,\r\n}\r\n\r\n/** An abstraction over the behavior of transports. This is designed to support the framework and not intended for use by applications. */\r\nexport interface ITransport {\r\n connect(url: string, transferFormat: TransferFormat): Promise;\r\n send(data: any): Promise;\r\n stop(): Promise;\r\n onreceive: ((data: string | ArrayBuffer) => void) | null;\r\n onclose: ((error?: Error) => void) | null;\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/dist/esm/AbortController.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"AbortController.js","sourceRoot":"","sources":["../../src/AbortController.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,+GAA+G;AAE/G,qFAAqF;AACrF,0FAA0F;AAC1F,iCAAiC;AAEjC,2BAA2B;AAC3B,eAAe;AACf;IAAA;QACY,cAAS,GAAY,KAAK,CAAC;QAC5B,YAAO,GAAwB,IAAI,CAAC;IAkB/C,CAAC;IAhBU,+BAAK,GAAZ;QACI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,IAAI,CAAC,OAAO,EAAE;gBACd,IAAI,CAAC,OAAO,EAAE,CAAC;aAClB;SACJ;IACL,CAAC;IAED,sBAAI,mCAAM;aAAV;YACI,OAAO,IAAI,CAAC;QAChB,CAAC;;;OAAA;IAED,sBAAI,oCAAO;aAAX;YACI,OAAO,IAAI,CAAC,SAAS,CAAC;QAC1B,CAAC;;;OAAA;IACL,sBAAC;AAAD,CAAC,AApBD,IAoBC","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController\r\n// We don't actually ever use the API being polyfilled, we always use the polyfill because\r\n// it's a very new API right now.\r\n\r\n// Not exported from index.\r\n/** @private */\r\nexport class AbortController implements AbortSignal {\r\n private isAborted: boolean = false;\r\n public onabort: (() => void) | null = null;\r\n\r\n public abort() {\r\n if (!this.isAborted) {\r\n this.isAborted = true;\r\n if (this.onabort) {\r\n this.onabort();\r\n }\r\n }\r\n }\r\n\r\n get signal(): AbortSignal {\r\n return this;\r\n }\r\n\r\n get aborted(): boolean {\r\n return this.isAborted;\r\n }\r\n}\r\n\r\n/** Represents a signal that can be monitored to determine if a request has been aborted. */\r\nexport interface AbortSignal {\r\n /** Indicates if the request has been aborted. */\r\n aborted: boolean;\r\n /** Set this to a handler that will be invoked when the request is aborted. */\r\n onabort: (() => void) | null;\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/dist/esm/Utils.d.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient } from "./HttpClient";
2 | import { ILogger, LogLevel } from "./ILogger";
3 | import { IStreamSubscriber, ISubscription } from "./Stream";
4 | import { Subject } from "./Subject";
5 | /** @private */
6 | export declare class Arg {
7 | static isRequired(val: any, name: string): void;
8 | static isIn(val: any, values: any, name: string): void;
9 | }
10 | /** @private */
11 | export declare class Platform {
12 | static readonly isBrowser: boolean;
13 | static readonly isWebWorker: boolean;
14 | static readonly isNode: boolean;
15 | }
16 | /** @private */
17 | export declare function getDataDetail(data: any, includeContent: boolean): string;
18 | /** @private */
19 | export declare function formatArrayBuffer(data: ArrayBuffer): string;
20 | /** @private */
21 | export declare function isArrayBuffer(val: any): val is ArrayBuffer;
22 | /** @private */
23 | export declare function sendMessage(logger: ILogger, transportName: string, httpClient: HttpClient, url: string, accessTokenFactory: (() => string | Promise) | undefined, content: string | ArrayBuffer, logMessageContent: boolean): Promise;
24 | /** @private */
25 | export declare function createLogger(logger?: ILogger | LogLevel): ILogger;
26 | /** @private */
27 | export declare class SubjectSubscription implements ISubscription {
28 | private subject;
29 | private observer;
30 | constructor(subject: Subject, observer: IStreamSubscriber);
31 | dispose(): void;
32 | }
33 | /** @private */
34 | export declare class ConsoleLogger implements ILogger {
35 | private readonly minimumLogLevel;
36 | outputConsole: {
37 | error(message: any): void;
38 | warn(message: any): void;
39 | info(message: any): void;
40 | log(message: any): void;
41 | };
42 | constructor(minimumLogLevel: LogLevel);
43 | log(logLevel: LogLevel, message: string): void;
44 | }
45 |
--------------------------------------------------------------------------------
/signalr/dist/cjs/ITransport.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"ITransport.js","sourceRoot":"","sources":["../../src/ITransport.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;AAE/G,6FAA6F;AAC7F,gDAAgD;AAChD,IAAY,iBASX;AATD,WAAY,iBAAiB;IACzB,yCAAyC;IACzC,yDAAQ,CAAA;IACR,0CAA0C;IAC1C,qEAAc,CAAA;IACd,kDAAkD;IAClD,iFAAoB,CAAA;IACpB,4CAA4C;IAC5C,uEAAe,CAAA;AACnB,CAAC,EATW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAS5B;AAED,sDAAsD;AACtD,IAAY,cAKX;AALD,WAAY,cAAc;IACtB,6EAA6E;IAC7E,mDAAQ,CAAA;IACR,0EAA0E;IAC1E,uDAAU,CAAA;AACd,CAAC,EALW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAKzB","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// This will be treated as a bit flag in the future, so we keep it using power-of-two values.\r\n/** Specifies a specific HTTP transport type. */\r\nexport enum HttpTransportType {\r\n /** Specifies no transport preference. */\r\n None = 0,\r\n /** Specifies the WebSockets transport. */\r\n WebSockets = 1,\r\n /** Specifies the Server-Sent Events transport. */\r\n ServerSentEvents = 2,\r\n /** Specifies the Long Polling transport. */\r\n LongPolling = 4,\r\n}\r\n\r\n/** Specifies the transfer format for a connection. */\r\nexport enum TransferFormat {\r\n /** Specifies that only text data will be transmitted over the connection. */\r\n Text = 1,\r\n /** Specifies that binary data will be transmitted over the connection. */\r\n Binary = 2,\r\n}\r\n\r\n/** An abstraction over the behavior of transports. This is designed to support the framework and not intended for use by applications. */\r\nexport interface ITransport {\r\n connect(url: string, transferFormat: TransferFormat): Promise;\r\n send(data: any): Promise;\r\n stop(): Promise;\r\n onreceive: ((data: string | ArrayBuffer) => void) | null;\r\n onclose: ((error?: Error) => void) | null;\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/dist/cjs/AbortController.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"AbortController.js","sourceRoot":"","sources":["../../src/AbortController.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;AAE/G,qFAAqF;AACrF,0FAA0F;AAC1F,iCAAiC;AAEjC,2BAA2B;AAC3B,eAAe;AACf;IAAA;QACY,cAAS,GAAY,KAAK,CAAC;QAC5B,YAAO,GAAwB,IAAI,CAAC;IAkB/C,CAAC;IAhBU,+BAAK,GAAZ;QACI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,IAAI,CAAC,OAAO,EAAE;gBACd,IAAI,CAAC,OAAO,EAAE,CAAC;aAClB;SACJ;IACL,CAAC;IAED,sBAAI,mCAAM;aAAV;YACI,OAAO,IAAI,CAAC;QAChB,CAAC;;;OAAA;IAED,sBAAI,oCAAO;aAAX;YACI,OAAO,IAAI,CAAC,SAAS,CAAC;QAC1B,CAAC;;;OAAA;IACL,sBAAC;AAAD,CAAC,AApBD,IAoBC;AApBY,0CAAe","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController\r\n// We don't actually ever use the API being polyfilled, we always use the polyfill because\r\n// it's a very new API right now.\r\n\r\n// Not exported from index.\r\n/** @private */\r\nexport class AbortController implements AbortSignal {\r\n private isAborted: boolean = false;\r\n public onabort: (() => void) | null = null;\r\n\r\n public abort() {\r\n if (!this.isAborted) {\r\n this.isAborted = true;\r\n if (this.onabort) {\r\n this.onabort();\r\n }\r\n }\r\n }\r\n\r\n get signal(): AbortSignal {\r\n return this;\r\n }\r\n\r\n get aborted(): boolean {\r\n return this.isAborted;\r\n }\r\n}\r\n\r\n/** Represents a signal that can be monitored to determine if a request has been aborted. */\r\nexport interface AbortSignal {\r\n /** Indicates if the request has been aborted. */\r\n aborted: boolean;\r\n /** Set this to a handler that will be invoked when the request is aborted. */\r\n onabort: (() => void) | null;\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/dist/esm/IHttpConnectionOptions.d.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient } from "./HttpClient";
2 | import { ILogger, LogLevel } from "./ILogger";
3 | import { HttpTransportType, ITransport } from "./ITransport";
4 | /** Options provided to the 'withUrl' method on {@link @microsoft/signalr.HubConnectionBuilder} to configure options for the HTTP-based transports. */
5 | export interface IHttpConnectionOptions {
6 | /** An {@link @microsoft/signalr.HttpClient} that will be used to make HTTP requests. */
7 | httpClient?: HttpClient;
8 | /** An {@link @microsoft/signalr.HttpTransportType} value specifying the transport to use for the connection. */
9 | transport?: HttpTransportType | ITransport;
10 | /** Configures the logger used for logging.
11 | *
12 | * Provide an {@link @microsoft/signalr.ILogger} instance, and log messages will be logged via that instance. Alternatively, provide a value from
13 | * the {@link @microsoft/signalr.LogLevel} enumeration and a default logger which logs to the Console will be configured to log messages of the specified
14 | * level (or higher).
15 | */
16 | logger?: ILogger | LogLevel;
17 | /** A function that provides an access token required for HTTP Bearer authentication.
18 | *
19 | * @returns {string | Promise} A string containing the access token, or a Promise that resolves to a string containing the access token.
20 | */
21 | accessTokenFactory?(): string | Promise;
22 | /** A boolean indicating if message content should be logged.
23 | *
24 | * Message content can contain sensitive user data, so this is disabled by default.
25 | */
26 | logMessageContent?: boolean;
27 | /** A boolean indicating if negotiation should be skipped.
28 | *
29 | * Negotiation can only be skipped when the {@link @microsoft/signalr.IHttpConnectionOptions.transport} property is set to 'HttpTransportType.WebSockets'.
30 | */
31 | skipNegotiation?: boolean;
32 | }
33 |
--------------------------------------------------------------------------------
/signalr/src/DefaultHttpClient.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | import { AbortError } from "./Errors";
5 | import { HttpClient, HttpRequest, HttpResponse } from "./HttpClient";
6 | import { ILogger } from "./ILogger";
7 | import { WeChatHttpClient } from "./WeChatHttpClient";
8 |
9 | /** Default implementation of {@link @microsoft/signalr.HttpClient}. */
10 | export class DefaultHttpClient extends HttpClient {
11 | private readonly httpClient: HttpClient;
12 |
13 | /** Creates a new instance of the {@link @microsoft/signalr.DefaultHttpClient}, using the provided {@link @microsoft/signalr.ILogger} to log messages. */
14 | public constructor(logger: ILogger) {
15 | super();
16 | this.httpClient = new WeChatHttpClient(logger);
17 | // if (typeof fetch !== "undefined") {
18 | // this.httpClient = new FetchHttpClient(logger);
19 | // } else if (typeof XMLHttpRequest !== "undefined") {
20 | // this.httpClient = new XhrHttpClient(logger);
21 | // } else {
22 | // this.httpClient = new NodeHttpClient(logger);
23 | // }
24 | }
25 |
26 | /** @inheritDoc */
27 | public send(request: HttpRequest): Promise {
28 | // Check that abort was not signaled before calling send
29 | if (request.abortSignal && request.abortSignal.aborted) {
30 | return Promise.reject(new AbortError());
31 | }
32 |
33 | if (!request.method) {
34 | return Promise.reject(new Error("No method defined."));
35 | }
36 | if (!request.url) {
37 | return Promise.reject(new Error("No url defined."));
38 | }
39 |
40 | return this.httpClient.send(request);
41 | }
42 |
43 | public getCookieString(url: string): string {
44 | return this.httpClient.getCookieString(url);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/signalr/dist/esm/ILogger.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"ILogger.js","sourceRoot":"","sources":["../../src/ILogger.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,+GAA+G;AAE/G,2GAA2G;AAC3G;;;GAGG;AACH,MAAM,CAAN,IAAY,QAeX;AAfD,WAAY,QAAQ;IAChB,2DAA2D;IAC3D,yCAAS,CAAA;IACT,sDAAsD;IACtD,yCAAS,CAAA;IACT,uDAAuD;IACvD,qDAAe,CAAA;IACf,2EAA2E;IAC3E,6CAAW,CAAA;IACX,0FAA0F;IAC1F,yCAAS,CAAA;IACT,4GAA4G;IAC5G,+CAAY,CAAA;IACZ,wHAAwH;IACxH,uCAAQ,CAAA;AACZ,CAAC,EAfW,QAAQ,KAAR,QAAQ,QAenB","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.\r\n/** Indicates the severity of a log message.\r\n *\r\n * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.\r\n */\r\nexport enum LogLevel {\r\n /** Log level for very low severity diagnostic messages. */\r\n Trace = 0,\r\n /** Log level for low severity diagnostic messages. */\r\n Debug = 1,\r\n /** Log level for informational diagnostic messages. */\r\n Information = 2,\r\n /** Log level for diagnostic messages that indicate a non-fatal problem. */\r\n Warning = 3,\r\n /** Log level for diagnostic messages that indicate a failure in the current operation. */\r\n Error = 4,\r\n /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */\r\n Critical = 5,\r\n /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */\r\n None = 6,\r\n}\r\n\r\n/** An abstraction that provides a sink for diagnostic messages. */\r\nexport interface ILogger {\r\n /** Called by the framework to emit a diagnostic message.\r\n *\r\n * @param {LogLevel} logLevel The severity level of the message.\r\n * @param {string} message The message.\r\n */\r\n log(logLevel: LogLevel, message: string): void;\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr/dist/esm/Stream.d.ts:
--------------------------------------------------------------------------------
1 | /** Defines the expected type for a receiver of results streamed by the server.
2 | *
3 | * @typeparam T The type of the items being sent by the server.
4 | */
5 | export interface IStreamSubscriber {
6 | /** A boolean that will be set by the {@link @microsoft/signalr.IStreamResult} when the stream is closed. */
7 | closed?: boolean;
8 | /** Called by the framework when a new item is available. */
9 | next(value: T): void;
10 | /** Called by the framework when an error has occurred.
11 | *
12 | * After this method is called, no additional methods on the {@link @microsoft/signalr.IStreamSubscriber} will be called.
13 | */
14 | error(err: any): void;
15 | /** Called by the framework when the end of the stream is reached.
16 | *
17 | * After this method is called, no additional methods on the {@link @microsoft/signalr.IStreamSubscriber} will be called.
18 | */
19 | complete(): void;
20 | }
21 | /** Defines the result of a streaming hub method.
22 | *
23 | * @typeparam T The type of the items being sent by the server.
24 | */
25 | export interface IStreamResult {
26 | /** Attaches a {@link @microsoft/signalr.IStreamSubscriber}, which will be invoked when new items are available from the stream.
27 | *
28 | * @param {IStreamSubscriber} observer The subscriber to attach.
29 | * @returns {ISubscription} A subscription that can be disposed to terminate the stream and stop calling methods on the {@link @microsoft/signalr.IStreamSubscriber}.
30 | */
31 | subscribe(subscriber: IStreamSubscriber): ISubscription;
32 | }
33 | /** An interface that allows an {@link @microsoft/signalr.IStreamSubscriber} to be disconnected from a stream.
34 | *
35 | * @typeparam T The type of the items being sent by the server.
36 | */
37 | export interface ISubscription {
38 | /** Disconnects the {@link @microsoft/signalr.IStreamSubscriber} associated with this subscription from the stream. */
39 | dispose(): void;
40 | }
41 |
--------------------------------------------------------------------------------
/signalr/dist/cjs/ILogger.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"ILogger.js","sourceRoot":"","sources":["../../src/ILogger.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;AAE/G,2GAA2G;AAC3G;;;GAGG;AACH,IAAY,QAeX;AAfD,WAAY,QAAQ;IAChB,2DAA2D;IAC3D,yCAAS,CAAA;IACT,sDAAsD;IACtD,yCAAS,CAAA;IACT,uDAAuD;IACvD,qDAAe,CAAA;IACf,2EAA2E;IAC3E,6CAAW,CAAA;IACX,0FAA0F;IAC1F,yCAAS,CAAA;IACT,4GAA4G;IAC5G,+CAAY,CAAA;IACZ,wHAAwH;IACxH,uCAAQ,CAAA;AACZ,CAAC,EAfW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAenB","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n\r\n// These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.\r\n/** Indicates the severity of a log message.\r\n *\r\n * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.\r\n */\r\nexport enum LogLevel {\r\n /** Log level for very low severity diagnostic messages. */\r\n Trace = 0,\r\n /** Log level for low severity diagnostic messages. */\r\n Debug = 1,\r\n /** Log level for informational diagnostic messages. */\r\n Information = 2,\r\n /** Log level for diagnostic messages that indicate a non-fatal problem. */\r\n Warning = 3,\r\n /** Log level for diagnostic messages that indicate a failure in the current operation. */\r\n Error = 4,\r\n /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */\r\n Critical = 5,\r\n /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */\r\n None = 6,\r\n}\r\n\r\n/** An abstraction that provides a sink for diagnostic messages. */\r\nexport interface ILogger {\r\n /** Called by the framework to emit a diagnostic message.\r\n *\r\n * @param {LogLevel} logLevel The severity level of the message.\r\n * @param {string} message The message.\r\n */\r\n log(logLevel: LogLevel, message: string): void;\r\n}\r\n"]}
--------------------------------------------------------------------------------
/signalr-protocol-msgpack/README.md:
--------------------------------------------------------------------------------
1 | MsgPack support for SignalR for ASP.NET Core
2 |
3 | ## Installation
4 |
5 | ```bash
6 | npm install @microsoft/signalr-protocol-msgpack
7 | ```
8 | or
9 | ```bash
10 | yarn add @microsoft/signalr-protocol-msgpack
11 | ```
12 |
13 | ## Usage
14 |
15 | See the [SignalR Documentation](https://docs.microsoft.com/aspnet/core/signalr) at docs.microsoft.com for documentation on the latest release. [API Reference Documentation](https://docs.microsoft.com/javascript/api/%40aspnet/signalr-protocol-msgpack/?view=signalr-js-latest) is also available on docs.microsoft.com.
16 |
17 | ### Browser
18 |
19 | To use the client in a browser, copy `*.js` files from the `dist/browser` folder to your script folder include on your page using the `