snack-sdk 3.10.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/build/Session.d.ts +4 -2
- package/build/Session.js +30 -29
- package/build/Session.js.map +1 -1
- package/build/defaultConfig.d.ts +2 -0
- package/build/defaultConfig.js +3 -1
- package/build/defaultConfig.js.map +1 -1
- package/build/transports/CompositeTransport.d.ts +8 -0
- package/build/transports/CompositeTransport.js +33 -0
- package/build/transports/CompositeTransport.js.map +1 -0
- package/build/transports/CompositedTransport.d.ts +8 -0
- package/build/transports/CompositedTransport.js +33 -0
- package/build/transports/CompositedTransport.js.map +1 -0
- package/build/transports/ConnectionMetricsEmitter.d.ts +23 -0
- package/build/transports/ConnectionMetricsEmitter.js +49 -0
- package/build/transports/ConnectionMetricsEmitter.js.map +1 -0
- package/build/transports/TrafficMirroringTransport.d.ts +8 -0
- package/build/transports/TrafficMirroringTransport.js +33 -0
- package/build/transports/TrafficMirroringTransport.js.map +1 -0
- package/build/transports/TransportImplBase.d.ts +52 -0
- package/build/transports/TransportImplBase.js +233 -0
- package/build/transports/TransportImplBase.js.map +1 -0
- package/build/transports/TransportImplComposited.d.ts +8 -0
- package/build/transports/TransportImplComposited.js +33 -0
- package/build/transports/TransportImplComposited.js.map +1 -0
- package/build/transports/TransportImplPubNub.d.ts +15 -0
- package/build/transports/TransportImplPubNub.js +169 -0
- package/build/transports/TransportImplPubNub.js.map +1 -0
- package/build/transports/TransportImplSocketIO.d.ts +18 -0
- package/build/transports/TransportImplSocketIO.js +120 -0
- package/build/transports/TransportImplSocketIO.js.map +1 -0
- package/build/transports/TransportImplWebPlayer.d.ts +23 -0
- package/build/transports/TransportImplWebPlayer.js +128 -0
- package/build/transports/TransportImplWebPlayer.js.map +1 -0
- package/build/transports/index.d.ts +3 -0
- package/build/transports/index.js +11 -3
- package/build/transports/index.js.map +1 -1
- package/build/transports/types.d.ts +2 -3
- package/build/transports/types.js.map +1 -1
- package/build/transports/webPlayer.d.ts +1 -2
- package/build/transports/webPlayer.js +5 -57
- package/build/transports/webPlayer.js.map +1 -1
- package/build/types.d.ts +1 -1
- package/build/types.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
17
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
18
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
19
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
20
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
21
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
25
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
26
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
27
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
28
|
+
function step(op) {
|
|
29
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
30
|
+
while (_) try {
|
|
31
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
32
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
33
|
+
switch (op[0]) {
|
|
34
|
+
case 0: case 1: t = op; break;
|
|
35
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
36
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
37
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
38
|
+
default:
|
|
39
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
40
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
41
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
42
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
43
|
+
if (t[2]) _.ops.pop();
|
|
44
|
+
_.trys.pop(); continue;
|
|
45
|
+
}
|
|
46
|
+
op = body.call(thisArg, _);
|
|
47
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
48
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
52
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
53
|
+
};
|
|
54
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
+
exports.calcPubNubCodeMessageSize = void 0;
|
|
56
|
+
var pubnub_1 = __importDefault(require("pubnub"));
|
|
57
|
+
var TransportImplBase_1 = __importDefault(require("./TransportImplBase"));
|
|
58
|
+
function calcPubNubCodeMessageSize(channel, codeMessage) {
|
|
59
|
+
// https://support.pubnub.com/hc/en-us/articles/360051495932-Calculating-message-payload-size-before-publishing
|
|
60
|
+
return (encodeURIComponent(channel +
|
|
61
|
+
JSON.stringify(codeMessage).replace(/[!~*'()]/g, function (x) { return "%" + x.charCodeAt(0).toString(16).toUpperCase(); })).length + 200);
|
|
62
|
+
}
|
|
63
|
+
exports.calcPubNubCodeMessageSize = calcPubNubCodeMessageSize;
|
|
64
|
+
var TransportImplPubNub = /** @class */ (function (_super) {
|
|
65
|
+
__extends(TransportImplPubNub, _super);
|
|
66
|
+
function TransportImplPubNub() {
|
|
67
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
68
|
+
_this.onPubNubPresence = function (event) {
|
|
69
|
+
switch (event.action) {
|
|
70
|
+
case 'join':
|
|
71
|
+
_this.handleChannelEvent('join', event.uuid);
|
|
72
|
+
break;
|
|
73
|
+
case 'timeout':
|
|
74
|
+
case 'leave':
|
|
75
|
+
_this.handleChannelEvent('leave', event.uuid);
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
_this.onPubNubMessage = function (event) {
|
|
80
|
+
var message = event.message;
|
|
81
|
+
_this.handleMessage(event.publisher, message);
|
|
82
|
+
};
|
|
83
|
+
_this.onPubNubStatus = function (_event) {
|
|
84
|
+
// TODO: Do something here?
|
|
85
|
+
};
|
|
86
|
+
return _this;
|
|
87
|
+
}
|
|
88
|
+
TransportImplPubNub.prototype.start = function () {
|
|
89
|
+
var _a;
|
|
90
|
+
this.stop();
|
|
91
|
+
if (!this.pubNubClientId) {
|
|
92
|
+
// Keep track of the client ID per transport instance.
|
|
93
|
+
// See: https://support.pubnub.com/hc/en-us/articles/360051496532-How-do-I-set-the-UUID-
|
|
94
|
+
this.pubNubClientId = pubnub_1.default.generateUUID();
|
|
95
|
+
}
|
|
96
|
+
if (this.channel) {
|
|
97
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.comm('Starting channel...', this.channel, this.logSuffix);
|
|
98
|
+
this.pubNub = new pubnub_1.default({
|
|
99
|
+
publishKey: 'pub-c-2a7fd67b-333d-40db-ad2d-3255f8835f70',
|
|
100
|
+
subscribeKey: 'sub-c-0b655000-d784-11e6-b950-02ee2ddab7fe',
|
|
101
|
+
uuid: this.pubNubClientId,
|
|
102
|
+
ssl: true,
|
|
103
|
+
presenceTimeout: 600,
|
|
104
|
+
heartbeatInterval: 60,
|
|
105
|
+
});
|
|
106
|
+
this.pubNub.addListener({
|
|
107
|
+
presence: this.onPubNubPresence,
|
|
108
|
+
message: this.onPubNubMessage,
|
|
109
|
+
status: this.onPubNubStatus,
|
|
110
|
+
});
|
|
111
|
+
this.pubNub.subscribe({
|
|
112
|
+
channels: [this.channel],
|
|
113
|
+
withPresence: true,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
TransportImplPubNub.prototype.stop = function () {
|
|
118
|
+
var _a;
|
|
119
|
+
if (this.pubNub) {
|
|
120
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.comm('Stopping...', this.logSuffix);
|
|
121
|
+
this.pubNub.removeListener({
|
|
122
|
+
presence: this.onPubNubPresence,
|
|
123
|
+
message: this.onPubNubMessage,
|
|
124
|
+
status: this.onPubNubStatus,
|
|
125
|
+
});
|
|
126
|
+
this.pubNub.unsubscribe({
|
|
127
|
+
channels: [this.channel],
|
|
128
|
+
});
|
|
129
|
+
this.pubNub.stop();
|
|
130
|
+
this.pubNub = undefined;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
TransportImplPubNub.prototype.isStarted = function () {
|
|
134
|
+
return this.pubNub != null;
|
|
135
|
+
};
|
|
136
|
+
TransportImplPubNub.prototype.sendAsync = function (channel, message) {
|
|
137
|
+
var _a;
|
|
138
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
139
|
+
return __generator(this, function (_b) {
|
|
140
|
+
switch (_b.label) {
|
|
141
|
+
case 0: return [4 /*yield*/, ((_a = this.pubNub) === null || _a === void 0 ? void 0 : _a.publish({
|
|
142
|
+
channel: channel,
|
|
143
|
+
message: message,
|
|
144
|
+
}))];
|
|
145
|
+
case 1:
|
|
146
|
+
_b.sent();
|
|
147
|
+
return [2 /*return*/];
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
TransportImplPubNub.prototype.onVerifyCodeMessageSize = function (codeMessage) {
|
|
153
|
+
// Calculate unencoded size (quickly) and if that exceeds the limit
|
|
154
|
+
// then don't bother calculating the exact size (which is more expensive)
|
|
155
|
+
var approxSize = 0;
|
|
156
|
+
for (var path in codeMessage.diff) {
|
|
157
|
+
approxSize += path.length + codeMessage.diff[path].length;
|
|
158
|
+
}
|
|
159
|
+
if (approxSize >= TransportImplBase_1.default.CODE_SIZE_LIMIT_FOR_DIFF) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
// Calculate exact size and check whether it exceeds the limit
|
|
163
|
+
var size = calcPubNubCodeMessageSize(this.channel, codeMessage);
|
|
164
|
+
return size < TransportImplBase_1.default.CODE_SIZE_LIMIT_FOR_DIFF;
|
|
165
|
+
};
|
|
166
|
+
return TransportImplPubNub;
|
|
167
|
+
}(TransportImplBase_1.default));
|
|
168
|
+
exports.default = TransportImplPubNub;
|
|
169
|
+
//# sourceMappingURL=TransportImplPubNub.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransportImplPubNub.js","sourceRoot":"","sources":["../../src/transports/TransportImplPubNub.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA4B;AAG5B,0EAAoD;AAEpD,SAAgB,yBAAyB,CAAC,OAAe,EAAE,WAAgC;IACzF,+GAA+G;IAC/G,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,uCAAS,GAAzB,UAA0B,OAAe,EAAE,OAAgC;;;;;4BACzE,4BAAM,IAAI,CAAC,MAAM,0CAAE,OAAO,CAAC;4BACzB,OAAO,SAAA;4BACP,OAAO,SAAA;yBACR,IAAC;;wBAHF,SAGE,CAAC;;;;;KACJ;IAES,qDAAuB,GAAjC,UAAkC,WAAgC;QAChE,mEAAmE;QACnE,yEAAyE;QACzE,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,KAAK,IAAM,IAAI,IAAI,WAAW,CAAC,IAAI,EAAE;YACnC,UAAU,IAAI,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;SAC3D;QACD,IAAI,UAAU,IAAI,2BAAiB,CAAC,wBAAwB,EAAE;YAC5D,OAAO,KAAK,CAAC;SACd;QAED,8DAA8D;QAC9D,IAAM,IAAI,GAAG,yBAAyB,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAClE,OAAO,IAAI,GAAG,2BAAiB,CAAC,wBAAwB,CAAC;IAC3D,CAAC;IAsBH,0BAAC;AAAD,CAAC,AAtGD,CAAiD,2BAAiB,GAsGjE","sourcesContent":["import PubNub from 'pubnub';\n\nimport { ProtocolOutgoingMessage, ProtocolIncomingMessage, ProtocolCodeMessage } from './Protocol';\nimport TransportImplBase from './TransportImplBase';\n\nexport function calcPubNubCodeMessageSize(channel: string, codeMessage: ProtocolCodeMessage) {\n // https://support.pubnub.com/hc/en-us/articles/360051495932-Calculating-message-payload-size-before-publishing\n return (\n encodeURIComponent(\n channel +\n JSON.stringify(codeMessage).replace(\n /[!~*'()]/g,\n (x) => `%${x.charCodeAt(0).toString(16).toUpperCase()}`\n )\n ).length + 200\n );\n}\n\nexport default class TransportImplPubNub extends TransportImplBase {\n private pubNub?: PubNub;\n private pubNubClientId?: string;\n\n protected start() {\n this.stop();\n\n if (!this.pubNubClientId) {\n // Keep track of the client ID per transport instance.\n // See: https://support.pubnub.com/hc/en-us/articles/360051496532-How-do-I-set-the-UUID-\n this.pubNubClientId = PubNub.generateUUID();\n }\n\n if (this.channel) {\n this.logger?.comm('Starting channel...', this.channel, this.logSuffix);\n this.pubNub = new PubNub({\n publishKey: 'pub-c-2a7fd67b-333d-40db-ad2d-3255f8835f70',\n subscribeKey: 'sub-c-0b655000-d784-11e6-b950-02ee2ddab7fe',\n uuid: this.pubNubClientId,\n ssl: true,\n presenceTimeout: 600,\n heartbeatInterval: 60,\n });\n\n this.pubNub.addListener({\n presence: this.onPubNubPresence,\n message: this.onPubNubMessage,\n status: this.onPubNubStatus,\n });\n\n this.pubNub.subscribe({\n channels: [this.channel],\n withPresence: true,\n });\n }\n }\n\n protected stop() {\n if (this.pubNub) {\n this.logger?.comm('Stopping...', this.logSuffix);\n this.pubNub.removeListener({\n presence: this.onPubNubPresence,\n message: this.onPubNubMessage,\n status: this.onPubNubStatus,\n });\n\n this.pubNub.unsubscribe({\n channels: [this.channel],\n });\n\n this.pubNub.stop();\n this.pubNub = undefined;\n }\n }\n\n protected isStarted() {\n return this.pubNub != null;\n }\n\n protected async sendAsync(channel: string, message: ProtocolOutgoingMessage): Promise<void> {\n await this.pubNub?.publish({\n channel,\n message,\n });\n }\n\n protected onVerifyCodeMessageSize(codeMessage: ProtocolCodeMessage): boolean {\n // Calculate unencoded size (quickly) and if that exceeds the limit\n // then don't bother calculating the exact size (which is more expensive)\n let approxSize = 0;\n for (const path in codeMessage.diff) {\n approxSize += path.length + codeMessage.diff[path].length;\n }\n if (approxSize >= TransportImplBase.CODE_SIZE_LIMIT_FOR_DIFF) {\n return false;\n }\n\n // Calculate exact size and check whether it exceeds the limit\n const size = calcPubNubCodeMessageSize(this.channel, codeMessage);\n return size < TransportImplBase.CODE_SIZE_LIMIT_FOR_DIFF;\n }\n\n private onPubNubPresence = (event: PubNub.PresenceEvent) => {\n switch (event.action) {\n case 'join':\n this.handleChannelEvent('join', event.uuid);\n break;\n case 'timeout':\n case 'leave':\n this.handleChannelEvent('leave', event.uuid);\n break;\n }\n };\n\n private onPubNubMessage = (event: PubNub.MessageEvent) => {\n const message: ProtocolIncomingMessage = event.message;\n this.handleMessage(event.publisher, message);\n };\n\n private onPubNubStatus = (_event: PubNub.StatusEvent) => {\n // TODO: Do something here?\n };\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ProtocolOutgoingMessage, ProtocolCodeMessage } from './Protocol';
|
|
2
|
+
import TransportImplBase from './TransportImplBase';
|
|
3
|
+
import type { SnackTransportOptions } from './types';
|
|
4
|
+
export default class TransportImplSocketIO extends TransportImplBase {
|
|
5
|
+
private readonly snackpubURL;
|
|
6
|
+
private socket;
|
|
7
|
+
private startTime;
|
|
8
|
+
private connectionAttempts;
|
|
9
|
+
constructor(options: SnackTransportOptions);
|
|
10
|
+
protected start(): void;
|
|
11
|
+
protected stop(): void;
|
|
12
|
+
protected isStarted(): boolean;
|
|
13
|
+
protected sendAsync(channel: string, message: ProtocolOutgoingMessage): Promise<void>;
|
|
14
|
+
protected onVerifyCodeMessageSize(codeMessage: ProtocolCodeMessage): boolean;
|
|
15
|
+
private onMessage;
|
|
16
|
+
private onJoinChannel;
|
|
17
|
+
private onLeaveChannel;
|
|
18
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
var socket_io_client_1 = require("socket.io-client");
|
|
20
|
+
var ConnectionMetricsEmitter_1 = __importDefault(require("./ConnectionMetricsEmitter"));
|
|
21
|
+
var TransportImplBase_1 = __importDefault(require("./TransportImplBase"));
|
|
22
|
+
var TransportImplSocketIO = /** @class */ (function (_super) {
|
|
23
|
+
__extends(TransportImplSocketIO, _super);
|
|
24
|
+
function TransportImplSocketIO(options) {
|
|
25
|
+
var _this = _super.call(this, options) || this;
|
|
26
|
+
_this.socket = null;
|
|
27
|
+
_this.onMessage = function (data) {
|
|
28
|
+
var sender = data.sender, message = data.message;
|
|
29
|
+
_this.handleMessage(sender, message);
|
|
30
|
+
};
|
|
31
|
+
_this.onJoinChannel = function (data) {
|
|
32
|
+
var _a;
|
|
33
|
+
var sender = data.sender;
|
|
34
|
+
if (sender !== '' && sender !== ((_a = _this.socket) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
35
|
+
_this.handleChannelEvent('join', sender);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
_this.onLeaveChannel = function (data) {
|
|
39
|
+
var _a;
|
|
40
|
+
var sender = data.sender;
|
|
41
|
+
if (sender !== '' && sender !== ((_a = _this.socket) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
42
|
+
_this.handleChannelEvent('leave', sender);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var snackpubURL = options.snackpubURL;
|
|
46
|
+
if (!snackpubURL) {
|
|
47
|
+
throw new Error('The `snackpubURL` option is unspecified.');
|
|
48
|
+
}
|
|
49
|
+
_this.snackpubURL = snackpubURL;
|
|
50
|
+
_this.connectionAttempts = 0;
|
|
51
|
+
return _this;
|
|
52
|
+
}
|
|
53
|
+
TransportImplSocketIO.prototype.start = function () {
|
|
54
|
+
var _this = this;
|
|
55
|
+
this.stop();
|
|
56
|
+
this.startTime = Date.now();
|
|
57
|
+
this.socket = socket_io_client_1.io(this.snackpubURL, { transports: ['websocket'] });
|
|
58
|
+
this.socket.on('connect', function () {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
(_a = _this.socket) === null || _a === void 0 ? void 0 : _a.emit('subscribeChannel', { channel: _this.channel, sender: (_b = _this.socket) === null || _b === void 0 ? void 0 : _b.id });
|
|
61
|
+
if (_this.startTime) {
|
|
62
|
+
ConnectionMetricsEmitter_1.default.emitSuccessed({
|
|
63
|
+
timeMs: Date.now() - _this.startTime,
|
|
64
|
+
attempts: _this.connectionAttempts,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
this.socket.io.on('reconnect_attempt', function (attempts) {
|
|
69
|
+
_this.connectionAttempts = attempts;
|
|
70
|
+
if (_this.startTime) {
|
|
71
|
+
ConnectionMetricsEmitter_1.default.emitFailed({
|
|
72
|
+
timeMs: Date.now() - _this.startTime,
|
|
73
|
+
attempts: attempts,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
this.socket.on('message', this.onMessage);
|
|
78
|
+
this.socket.on('joinChannel', this.onJoinChannel);
|
|
79
|
+
this.socket.on('leaveChannel', this.onLeaveChannel);
|
|
80
|
+
this.socket.on('terminate', function (reason) {
|
|
81
|
+
var _a, _b;
|
|
82
|
+
(_a = _this.logger) === null || _a === void 0 ? void 0 : _a.comm("Terminating connection: " + reason);
|
|
83
|
+
(_b = _this.socket) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
TransportImplSocketIO.prototype.stop = function () {
|
|
87
|
+
var _a;
|
|
88
|
+
if (this.socket != null) {
|
|
89
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.comm('Stopping...', this.logSuffix);
|
|
90
|
+
this.socket.offAny();
|
|
91
|
+
this.socket.close();
|
|
92
|
+
this.socket = null;
|
|
93
|
+
}
|
|
94
|
+
this.startTime = undefined;
|
|
95
|
+
};
|
|
96
|
+
TransportImplSocketIO.prototype.isStarted = function () {
|
|
97
|
+
return this.socket != null;
|
|
98
|
+
};
|
|
99
|
+
TransportImplSocketIO.prototype.sendAsync = function (channel, message) {
|
|
100
|
+
var _a;
|
|
101
|
+
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.emit('message', {
|
|
102
|
+
channel: channel,
|
|
103
|
+
message: message,
|
|
104
|
+
sender: this.socket.id,
|
|
105
|
+
});
|
|
106
|
+
return Promise.resolve();
|
|
107
|
+
};
|
|
108
|
+
TransportImplSocketIO.prototype.onVerifyCodeMessageSize = function (codeMessage) {
|
|
109
|
+
// Calculate unencoded size (quickly) and if that exceeds the limit
|
|
110
|
+
// then don't bother calculating the exact size (which is more expensive)
|
|
111
|
+
var approxSize = 0;
|
|
112
|
+
for (var path in codeMessage.diff) {
|
|
113
|
+
approxSize += path.length + codeMessage.diff[path].length;
|
|
114
|
+
}
|
|
115
|
+
return approxSize < TransportImplBase_1.default.CODE_SIZE_LIMIT_FOR_DIFF;
|
|
116
|
+
};
|
|
117
|
+
return TransportImplSocketIO;
|
|
118
|
+
}(TransportImplBase_1.default));
|
|
119
|
+
exports.default = TransportImplSocketIO;
|
|
120
|
+
//# sourceMappingURL=TransportImplSocketIO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransportImplSocketIO.js","sourceRoot":"","sources":["../../src/transports/TransportImplSocketIO.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,qDAAsC;AAGtC,wFAAkE;AAElE,0EAAoD;AAgBpD;IAAmD,yCAAiB;IAMlE,+BAAY,OAA8B;QAA1C,YACE,kBAAM,OAAO,CAAC,SAOf;QAZO,YAAM,GAA8D,IAAI,CAAC;QAkFzE,eAAS,GAAG,UAAC,IAIpB;YACS,IAAA,MAAM,GAAc,IA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C,MAAM,0CAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,EAAE;YAEjD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACrB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACpB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;SACpB;QACD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAES,yCAAS,GAAnB;QACE,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC;IAC7B,CAAC;IAES,yCAAS,GAAnB,UAAoB,OAAe,EAAE,OAAgC;;QACnE,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,CAAC,SAAS,EAAE;YAC3B,OAAO,SAAA;YACP,OAAO,SAAA;YACP,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;SACvB,EAAE;QACH,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAES,uDAAuB,GAAjC,UAAkC,WAAgC;QAChE,mEAAmE;QACnE,yEAAyE;QACzE,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,KAAK,IAAM,IAAI,IAAI,WAAW,CAAC,IAAI,EAAE;YACnC,UAAU,IAAI,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;SAC3D;QACD,OAAO,UAAU,GAAG,2BAAiB,CAAC,wBAAwB,CAAC;IACjE,CAAC;IAwBH,4BAAC;AAAD,CAAC,AA1GD,CAAmD,2BAAiB,GA0GnE","sourcesContent":["import { io } from 'socket.io-client';\nimport type { Socket } from 'socket.io-client';\n\nimport ConnectionMetricsEmitter from './ConnectionMetricsEmitter';\nimport { ProtocolOutgoingMessage, ProtocolIncomingMessage, ProtocolCodeMessage } from './Protocol';\nimport TransportImplBase from './TransportImplBase';\nimport type { SnackTransportOptions } from './types';\n\ninterface ServerToClientEvents {\n message: (data: { channel: string; message: ProtocolIncomingMessage; sender: string }) => void;\n joinChannel: (data: { channel: string; sender: string }) => void;\n leaveChannel: (data: { channel: string; sender: string }) => void;\n terminate: (reason: string) => void;\n}\n\ninterface ClientToServerEvents {\n message: (data: { channel: string; message: ProtocolOutgoingMessage; sender: string }) => void;\n subscribeChannel: (data: { channel: string; sender: string }) => void;\n unsubscribeChannel: (data: { channel: string; sender: string }) => void;\n}\n\nexport default class TransportImplSocketIO extends TransportImplBase {\n private readonly snackpubURL: string;\n private socket: Socket<ServerToClientEvents, ClientToServerEvents> | null = null;\n private startTime: number | undefined;\n private connectionAttempts: number;\n\n constructor(options: SnackTransportOptions) {\n super(options);\n const { snackpubURL } = options;\n if (!snackpubURL) {\n throw new Error('The `snackpubURL` option is unspecified.');\n }\n this.snackpubURL = snackpubURL;\n this.connectionAttempts = 0;\n }\n\n protected start(): void {\n this.stop();\n this.startTime = Date.now();\n\n this.socket = io(this.snackpubURL, { transports: ['websocket'] });\n\n this.socket.on('connect', () => {\n this.socket?.emit('subscribeChannel', { channel: this.channel, sender: this.socket?.id });\n if (this.startTime) {\n ConnectionMetricsEmitter.emitSuccessed({\n timeMs: Date.now() - this.startTime,\n attempts: this.connectionAttempts,\n });\n }\n });\n this.socket.io.on('reconnect_attempt', (attempts: number) => {\n this.connectionAttempts = attempts;\n if (this.startTime) {\n ConnectionMetricsEmitter.emitFailed({\n timeMs: Date.now() - this.startTime,\n attempts,\n });\n }\n });\n\n this.socket.on('message', this.onMessage);\n this.socket.on('joinChannel', this.onJoinChannel);\n this.socket.on('leaveChannel', this.onLeaveChannel);\n this.socket.on('terminate', (reason) => {\n this.logger?.comm(`Terminating connection: ${reason}`);\n this.socket?.disconnect();\n });\n }\n\n protected stop(): void {\n if (this.socket != null) {\n this.logger?.comm('Stopping...', this.logSuffix);\n\n this.socket.offAny();\n this.socket.close();\n this.socket = null;\n }\n this.startTime = undefined;\n }\n\n protected isStarted(): boolean {\n return this.socket != null;\n }\n\n protected sendAsync(channel: string, message: ProtocolOutgoingMessage): Promise<void> {\n this.socket?.emit('message', {\n channel,\n message,\n sender: this.socket.id,\n });\n return Promise.resolve();\n }\n\n protected onVerifyCodeMessageSize(codeMessage: ProtocolCodeMessage): boolean {\n // Calculate unencoded size (quickly) and if that exceeds the limit\n // then don't bother calculating the exact size (which is more expensive)\n let approxSize = 0;\n for (const path in codeMessage.diff) {\n approxSize += path.length + codeMessage.diff[path].length;\n }\n return approxSize < TransportImplBase.CODE_SIZE_LIMIT_FOR_DIFF;\n }\n\n private onMessage = (data: {\n channel: string;\n message: ProtocolIncomingMessage;\n sender: string;\n }) => {\n const { sender, message } = data;\n this.handleMessage(sender, message);\n };\n\n private onJoinChannel = (data: { channel: string; sender: string }) => {\n const { sender } = data;\n if (sender !== '' && sender !== this.socket?.id) {\n this.handleChannelEvent('join', sender);\n }\n };\n\n private onLeaveChannel = (data: { channel: string; sender: string }) => {\n const { sender } = data;\n if (sender !== '' && sender !== this.socket?.id) {\n this.handleChannelEvent('leave', sender);\n }\n };\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SnackWindowRef } from '../types';
|
|
2
|
+
import type { ProtocolOutgoingMessage, ProtocolCodeMessage } from './Protocol';
|
|
3
|
+
import TransportImplBase from './TransportImplBase';
|
|
4
|
+
export interface TransportWebPlayerConfig {
|
|
5
|
+
name?: string;
|
|
6
|
+
verbose?: boolean;
|
|
7
|
+
webPlayerURL: string;
|
|
8
|
+
window: Window;
|
|
9
|
+
ref: SnackWindowRef;
|
|
10
|
+
}
|
|
11
|
+
export default class TransportImplWebPlayer extends TransportImplBase {
|
|
12
|
+
private currentWindow;
|
|
13
|
+
private targetWindowRef;
|
|
14
|
+
private status;
|
|
15
|
+
private readonly origin;
|
|
16
|
+
constructor(config: TransportWebPlayerConfig);
|
|
17
|
+
protected start(): void;
|
|
18
|
+
protected stop(): void;
|
|
19
|
+
protected isStarted(): boolean;
|
|
20
|
+
protected sendAsync(channel: string, message: ProtocolOutgoingMessage): Promise<void>;
|
|
21
|
+
protected onVerifyCodeMessageSize(codeMessage: ProtocolCodeMessage): boolean;
|
|
22
|
+
handleDomWindowMessage: (event: MessageEvent) => void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
17
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
18
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
19
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
20
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
21
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
25
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
26
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
27
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
28
|
+
function step(op) {
|
|
29
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
30
|
+
while (_) try {
|
|
31
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
32
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
33
|
+
switch (op[0]) {
|
|
34
|
+
case 0: case 1: t = op; break;
|
|
35
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
36
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
37
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
38
|
+
default:
|
|
39
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
40
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
41
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
42
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
43
|
+
if (t[2]) _.ops.pop();
|
|
44
|
+
_.trys.pop(); continue;
|
|
45
|
+
}
|
|
46
|
+
op = body.call(thisArg, _);
|
|
47
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
48
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
52
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
53
|
+
};
|
|
54
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
+
var assert_1 = __importDefault(require("assert"));
|
|
56
|
+
var TransportImplBase_1 = __importDefault(require("./TransportImplBase"));
|
|
57
|
+
var TransportImplWebPlayer = /** @class */ (function (_super) {
|
|
58
|
+
__extends(TransportImplWebPlayer, _super);
|
|
59
|
+
function TransportImplWebPlayer(config) {
|
|
60
|
+
var _this = _super.call(this, { name: config.name, verbose: config.verbose }) || this;
|
|
61
|
+
_this.status = 'stopped';
|
|
62
|
+
_this.handleDomWindowMessage = function (event) {
|
|
63
|
+
var _a;
|
|
64
|
+
if (event.origin === _this.origin) {
|
|
65
|
+
try {
|
|
66
|
+
var message = JSON.parse(event.data);
|
|
67
|
+
var type = message.type;
|
|
68
|
+
if (type === 'CONNECT') {
|
|
69
|
+
var connectionId = JSON.stringify(message.device);
|
|
70
|
+
_this.handleChannelEvent('join', connectionId);
|
|
71
|
+
}
|
|
72
|
+
else if (type === 'DISCONNECT') {
|
|
73
|
+
var connectionId = JSON.stringify(message.device);
|
|
74
|
+
_this.handleChannelEvent('leave', connectionId);
|
|
75
|
+
}
|
|
76
|
+
else if (type === 'MESSAGE') {
|
|
77
|
+
var connectionId = JSON.stringify(message.message.device);
|
|
78
|
+
_this.handleMessage(connectionId, message.message);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
(_a = _this.logger) === null || _a === void 0 ? void 0 : _a.warn('Invalid message', event.data);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var origin = new URL(config.webPlayerURL).origin;
|
|
87
|
+
_this.currentWindow = config.window;
|
|
88
|
+
_this.targetWindowRef = config.ref;
|
|
89
|
+
_this.status = 'stopped';
|
|
90
|
+
_this.origin = origin;
|
|
91
|
+
return _this;
|
|
92
|
+
}
|
|
93
|
+
TransportImplWebPlayer.prototype.start = function () {
|
|
94
|
+
var _a;
|
|
95
|
+
assert_1.default(this.currentWindow);
|
|
96
|
+
(_a = this.currentWindow) === null || _a === void 0 ? void 0 : _a.addEventListener('message', this.handleDomWindowMessage, false);
|
|
97
|
+
this.status = 'started';
|
|
98
|
+
};
|
|
99
|
+
TransportImplWebPlayer.prototype.stop = function () {
|
|
100
|
+
assert_1.default(this.currentWindow);
|
|
101
|
+
this.currentWindow.removeEventListener('message', this.handleDomWindowMessage, false);
|
|
102
|
+
this.currentWindow = undefined;
|
|
103
|
+
this.targetWindowRef = undefined;
|
|
104
|
+
this.status = 'stopped';
|
|
105
|
+
};
|
|
106
|
+
TransportImplWebPlayer.prototype.isStarted = function () {
|
|
107
|
+
return this.status === 'started' && this.currentWindow != null;
|
|
108
|
+
};
|
|
109
|
+
TransportImplWebPlayer.prototype.sendAsync = function (channel, message) {
|
|
110
|
+
var _a;
|
|
111
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
112
|
+
var targetWindow;
|
|
113
|
+
return __generator(this, function (_b) {
|
|
114
|
+
assert_1.default(this.isStarted);
|
|
115
|
+
targetWindow = (_a = this.targetWindowRef) === null || _a === void 0 ? void 0 : _a.current;
|
|
116
|
+
assert_1.default(targetWindow);
|
|
117
|
+
targetWindow.postMessage(JSON.stringify(message), this.origin);
|
|
118
|
+
return [2 /*return*/];
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
TransportImplWebPlayer.prototype.onVerifyCodeMessageSize = function (codeMessage) {
|
|
123
|
+
return true;
|
|
124
|
+
};
|
|
125
|
+
return TransportImplWebPlayer;
|
|
126
|
+
}(TransportImplBase_1.default));
|
|
127
|
+
exports.default = TransportImplWebPlayer;
|
|
128
|
+
//# sourceMappingURL=TransportImplWebPlayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransportImplWebPlayer.js","sourceRoot":"","sources":["../../src/transports/TransportImplWebPlayer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA4B;AAI5B,0EAAoD;AAUpD;IAAoD,0CAAiB;IAMnE,gCAAY,MAAgC;QAA5C,YACE,kBAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EA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ackWindowRef } from '../types';\nimport type { ProtocolOutgoingMessage, ProtocolCodeMessage } from './Protocol';\nimport TransportImplBase from './TransportImplBase';\n\nexport interface TransportWebPlayerConfig {\n name?: string;\n verbose?: boolean;\n webPlayerURL: string;\n window: Window;\n ref: SnackWindowRef;\n}\n\nexport default class TransportImplWebPlayer extends TransportImplBase {\n private currentWindow: Window | undefined;\n private targetWindowRef: SnackWindowRef | undefined;\n private status: 'stopped' | 'started' = 'stopped';\n private readonly origin: string;\n\n constructor(config: TransportWebPlayerConfig) {\n super({ name: config.name, verbose: config.verbose });\n const { origin } = new URL(config.webPlayerURL);\n this.currentWindow = config.window;\n this.targetWindowRef = config.ref;\n this.status = 'stopped';\n this.origin = origin;\n }\n\n protected start(): void {\n assert(this.currentWindow);\n this.currentWindow?.addEventListener('message', this.handleDomWindowMessage, false);\n this.status = 'started';\n }\n\n protected stop(): void {\n assert(this.currentWindow);\n this.currentWindow.removeEventListener('message', this.handleDomWindowMessage, false);\n this.currentWindow = undefined;\n this.targetWindowRef = undefined;\n this.status = 'stopped';\n }\n\n protected isStarted(): boolean {\n return this.status === 'started' && this.currentWindow != null;\n }\n\n protected async sendAsync(channel: string, message: ProtocolOutgoingMessage): Promise<void> {\n assert(this.isStarted);\n const targetWindow = this.targetWindowRef?.current;\n assert(targetWindow);\n targetWindow.postMessage(JSON.stringify(message), this.origin);\n }\n\n protected onVerifyCodeMessageSize(codeMessage: ProtocolCodeMessage): boolean {\n return true;\n }\n\n handleDomWindowMessage = (event: MessageEvent) => {\n if (event.origin === this.origin) {\n try {\n const message = JSON.parse(event.data);\n const { type } = message;\n if (type === 'CONNECT') {\n const connectionId = JSON.stringify(message.device);\n this.handleChannelEvent('join', connectionId);\n } else if (type === 'DISCONNECT') {\n const connectionId = JSON.stringify(message.device);\n this.handleChannelEvent('leave', connectionId);\n } else if (type === 'MESSAGE') {\n const connectionId = JSON.stringify(message.message.device);\n this.handleMessage(connectionId, message.message);\n }\n } catch (e: unknown) {\n this.logger?.warn('Invalid message', event.data);\n }\n }\n };\n}\n"]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { SnackTransport, SnackTransportOptions } from './types';
|
|
2
2
|
export * from './types';
|
|
3
|
+
export * from './ConnectionMetricsEmitter';
|
|
4
|
+
export { default as ConnectionMetricsEmitter } from './ConnectionMetricsEmitter';
|
|
3
5
|
export declare function createTransport(options: SnackTransportOptions): SnackTransport;
|
|
6
|
+
export declare function createTrafficMirroringTransport(options: SnackTransportOptions): SnackTransport;
|
|
@@ -13,11 +13,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.createTransport = void 0;
|
|
17
|
-
var
|
|
16
|
+
exports.createTrafficMirroringTransport = exports.createTransport = exports.ConnectionMetricsEmitter = void 0;
|
|
17
|
+
var TrafficMirroringTransport_1 = __importDefault(require("./TrafficMirroringTransport"));
|
|
18
|
+
var TransportImplSocketIO_1 = __importDefault(require("./TransportImplSocketIO"));
|
|
18
19
|
__exportStar(require("./types"), exports);
|
|
20
|
+
__exportStar(require("./ConnectionMetricsEmitter"), exports);
|
|
21
|
+
var ConnectionMetricsEmitter_1 = require("./ConnectionMetricsEmitter");
|
|
22
|
+
Object.defineProperty(exports, "ConnectionMetricsEmitter", { enumerable: true, get: function () { return __importDefault(ConnectionMetricsEmitter_1).default; } });
|
|
19
23
|
function createTransport(options) {
|
|
20
|
-
return new
|
|
24
|
+
return new TransportImplSocketIO_1.default(options);
|
|
21
25
|
}
|
|
22
26
|
exports.createTransport = createTransport;
|
|
27
|
+
function createTrafficMirroringTransport(options) {
|
|
28
|
+
return new TrafficMirroringTransport_1.default(options);
|
|
29
|
+
}
|
|
30
|
+
exports.createTrafficMirroringTransport = createTrafficMirroringTransport;
|
|
23
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transports/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transports/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0FAAoE;AACpE,kFAA4D;AAG5D,0CAAwB;AACxB,6DAA2C;AAC3C,uEAAiF;AAAxE,qJAAA,OAAO,OAA4B;AAE5C,SAAgB,eAAe,CAAC,OAA8B;IAC5D,OAAO,IAAI,+BAAqB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC;AAFD,0CAEC;AAED,SAAgB,+BAA+B,CAAC,OAA8B;IAC5E,OAAO,IAAI,mCAAyB,CAAC,OAAO,CAAC,CAAC;AAChD,CAAC;AAFD,0EAEC","sourcesContent":["import TrafficMirroringTransport from './TrafficMirroringTransport';\nimport TransportImplSocketIO from './TransportImplSocketIO';\nimport { SnackTransport, SnackTransportOptions } from './types';\n\nexport * from './types';\nexport * from './ConnectionMetricsEmitter';\nexport { default as ConnectionMetricsEmitter } from './ConnectionMetricsEmitter';\n\nexport function createTransport(options: SnackTransportOptions): SnackTransport {\n return new TransportImplSocketIO(options);\n}\n\nexport function createTrafficMirroringTransport(options: SnackTransportOptions): SnackTransport {\n return new TrafficMirroringTransport(options);\n}\n"]}
|
|
@@ -31,9 +31,7 @@ export declare type SnackTransportEventConnect = {
|
|
|
31
31
|
export declare type SnackTransportEventDisconnect = {
|
|
32
32
|
type: 'disconnect';
|
|
33
33
|
connectionId: string;
|
|
34
|
-
data:
|
|
35
|
-
timedout: boolean;
|
|
36
|
-
};
|
|
34
|
+
data: any;
|
|
37
35
|
};
|
|
38
36
|
export declare type SnackTransportEventProtocolMessage = {
|
|
39
37
|
type: 'protocol_message';
|
|
@@ -60,4 +58,5 @@ export declare type SnackTransportOptions = {
|
|
|
60
58
|
apiURL?: string;
|
|
61
59
|
verbose?: boolean;
|
|
62
60
|
name?: string;
|
|
61
|
+
snackpubURL?: string | undefined;
|
|
63
62
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/transports/types.ts"],"names":[],"mappings":"","sourcesContent":["import { SnackFiles, SnackDependencies, SDKVersion } from 'snack-content';\n\nimport { ProtocolOutgoingMessage, ProtocolIncomingMessage } from './Protocol';\n\nexport type SnackTransportStartMessage = {\n type: 'start';\n};\n\nexport type SnackTransportStopMessage = {\n type: 'stop';\n};\n\nexport type SnackTransportUpdateCodeMessage = {\n type: 'update_code';\n data: {\n files: SnackFiles;\n dependencies: SnackDependencies;\n sdkVersion: SDKVersion;\n };\n};\n\nexport type SnackTransportProtocolMessage = {\n type: 'protocol_message';\n data: ProtocolOutgoingMessage;\n};\n\nexport type SnackTransportSyntheticMessage = {\n type: 'synthetic_event';\n data: any;\n};\n\nexport type SnackTransportMessage =\n | SnackTransportStartMessage\n | SnackTransportStopMessage\n | SnackTransportUpdateCodeMessage\n | SnackTransportProtocolMessage\n | SnackTransportSyntheticMessage;\n\nexport type SnackTransportEventConnect = {\n type: 'connect';\n connectionId: string;\n data: any; // DeviceInfo\n};\n\nexport type SnackTransportEventDisconnect = {\n type: 'disconnect';\n connectionId: string;\n data
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/transports/types.ts"],"names":[],"mappings":"","sourcesContent":["import { SnackFiles, SnackDependencies, SDKVersion } from 'snack-content';\n\nimport { ProtocolOutgoingMessage, ProtocolIncomingMessage } from './Protocol';\n\nexport type SnackTransportStartMessage = {\n type: 'start';\n};\n\nexport type SnackTransportStopMessage = {\n type: 'stop';\n};\n\nexport type SnackTransportUpdateCodeMessage = {\n type: 'update_code';\n data: {\n files: SnackFiles;\n dependencies: SnackDependencies;\n sdkVersion: SDKVersion;\n };\n};\n\nexport type SnackTransportProtocolMessage = {\n type: 'protocol_message';\n data: ProtocolOutgoingMessage;\n};\n\nexport type SnackTransportSyntheticMessage = {\n type: 'synthetic_event';\n data: any;\n};\n\nexport type SnackTransportMessage =\n | SnackTransportStartMessage\n | SnackTransportStopMessage\n | SnackTransportUpdateCodeMessage\n | SnackTransportProtocolMessage\n | SnackTransportSyntheticMessage;\n\nexport type SnackTransportEventConnect = {\n type: 'connect';\n connectionId: string;\n data: any; // DeviceInfo\n};\n\nexport type SnackTransportEventDisconnect = {\n type: 'disconnect';\n connectionId: string;\n // Keeps the `data` keys here for SnackTransportEvent polymorphism, even though we do not use the data in disconnect event actually\n data: any;\n};\n\nexport type SnackTransportEventProtocolMessage = {\n type: 'protocol_message';\n connectionId: string;\n data: ProtocolIncomingMessage;\n};\n\nexport type SnackTransportEventSendMessage = {\n type: 'send_message';\n data: ProtocolOutgoingMessage;\n};\n\nexport type SnackTransportEventSyntheticMessage = {\n type: 'synthetic_event';\n data: any;\n};\n\nexport type SnackTransportEvent =\n | SnackTransportEventConnect\n | SnackTransportEventDisconnect\n | SnackTransportEventProtocolMessage\n | SnackTransportEventSendMessage\n | SnackTransportEventSyntheticMessage;\n\nexport type SnackTransportListener = (event: SnackTransportEvent) => void;\n\nexport interface SnackTransport {\n addEventListener(type: 'message', listener: SnackTransportListener): void;\n removeEventListener(type: 'message', listener: SnackTransportListener): void;\n postMessage(message: SnackTransportMessage): void;\n}\n\nexport type SnackTransportOptions = {\n channel?: string;\n apiURL?: string;\n verbose?: boolean;\n name?: string;\n snackpubURL?: string | undefined;\n};\n"]}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { SDKVersion } from 'snack-content';
|
|
2
2
|
import { SnackWindowRef } from '../types';
|
|
3
|
-
import { SnackTransport
|
|
3
|
+
import { SnackTransport } from './types';
|
|
4
4
|
export declare function createWebPlayerTransport(config: {
|
|
5
5
|
name?: string;
|
|
6
6
|
verbose?: boolean;
|
|
7
7
|
webPlayerURL: string;
|
|
8
8
|
window: Window;
|
|
9
9
|
ref: SnackWindowRef;
|
|
10
|
-
createTransport: (options: SnackTransportOptions) => SnackTransport;
|
|
11
10
|
}): SnackTransport;
|
|
12
11
|
export declare function getWebPlayerIFrameURL(webPlayerURL: string, sdkVersion: SDKVersion, initialURL: string, verbose: boolean): string | undefined;
|