@illgrenoble/webx-client 0.1.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/LICENSE +674 -0
- package/README.md +8 -0
- package/dist/WebXClient.d.ts +94 -0
- package/dist/WebXClient.js +302 -0
- package/dist/WebXClient.js.map +1 -0
- package/dist/display/WebXCursor.d.ts +28 -0
- package/dist/display/WebXCursor.js +94 -0
- package/dist/display/WebXCursor.js.map +1 -0
- package/dist/display/WebXCursorFactory.d.ts +18 -0
- package/dist/display/WebXCursorFactory.js +36 -0
- package/dist/display/WebXCursorFactory.js.map +1 -0
- package/dist/display/WebXDisplay.d.ts +70 -0
- package/dist/display/WebXDisplay.js +248 -0
- package/dist/display/WebXDisplay.js.map +1 -0
- package/dist/display/WebXSubImage.d.ts +19 -0
- package/dist/display/WebXSubImage.js +20 -0
- package/dist/display/WebXSubImage.js.map +1 -0
- package/dist/display/WebXTextureFactory.d.ts +14 -0
- package/dist/display/WebXTextureFactory.js +101 -0
- package/dist/display/WebXTextureFactory.js.map +1 -0
- package/dist/display/WebXWindow.d.ts +59 -0
- package/dist/display/WebXWindow.js +205 -0
- package/dist/display/WebXWindow.js.map +1 -0
- package/dist/display/WebXWindowProperties.d.ts +14 -0
- package/dist/display/WebXWindowProperties.js +17 -0
- package/dist/display/WebXWindowProperties.js.map +1 -0
- package/dist/display/index.d.ts +7 -0
- package/dist/display/index.js +24 -0
- package/dist/display/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/input/WebXKeyboard.d.ts +230 -0
- package/dist/input/WebXKeyboard.js +593 -0
- package/dist/input/WebXKeyboard.js.map +1 -0
- package/dist/input/WebXMouse.d.ts +97 -0
- package/dist/input/WebXMouse.js +205 -0
- package/dist/input/WebXMouse.js.map +1 -0
- package/dist/input/index.d.ts +4 -0
- package/dist/input/index.js +21 -0
- package/dist/input/index.js.map +1 -0
- package/dist/input/keyboard/WebXKeyEvent.d.ts +47 -0
- package/dist/input/keyboard/WebXKeyEvent.js +212 -0
- package/dist/input/keyboard/WebXKeyEvent.js.map +1 -0
- package/dist/input/keyboard/WebXKeyPressEvent.d.ts +13 -0
- package/dist/input/keyboard/WebXKeyPressEvent.js +26 -0
- package/dist/input/keyboard/WebXKeyPressEvent.js.map +1 -0
- package/dist/input/keyboard/WebXKeyUpEvent.d.ts +12 -0
- package/dist/input/keyboard/WebXKeyUpEvent.js +28 -0
- package/dist/input/keyboard/WebXKeyUpEvent.js.map +1 -0
- package/dist/input/keyboard/WebXKeyboardModifierState.d.ts +47 -0
- package/dist/input/keyboard/WebXKeyboardModifierState.js +87 -0
- package/dist/input/keyboard/WebXKeyboardModifierState.js.map +1 -0
- package/dist/input/keyboard/WebXKeyboardUtils.d.ts +9 -0
- package/dist/input/keyboard/WebXKeyboardUtils.js +48 -0
- package/dist/input/keyboard/WebXKeyboardUtils.js.map +1 -0
- package/dist/input/keyboard/WebXKeydownEvent.d.ts +29 -0
- package/dist/input/keyboard/WebXKeydownEvent.js +71 -0
- package/dist/input/keyboard/WebXKeydownEvent.js.map +1 -0
- package/dist/input/keyboard/index.d.ts +6 -0
- package/dist/input/keyboard/index.js +23 -0
- package/dist/input/keyboard/index.js.map +1 -0
- package/dist/input/mouse/WebXMouseState.d.ts +78 -0
- package/dist/input/mouse/WebXMouseState.js +104 -0
- package/dist/input/mouse/WebXMouseState.js.map +1 -0
- package/dist/input/mouse/index.d.ts +1 -0
- package/dist/input/mouse/index.js +18 -0
- package/dist/input/mouse/index.js.map +1 -0
- package/dist/instruction/WebXConnectInstruction.d.ts +4 -0
- package/dist/instruction/WebXConnectInstruction.js +12 -0
- package/dist/instruction/WebXConnectInstruction.js.map +1 -0
- package/dist/instruction/WebXCursorImageInstruction.d.ts +6 -0
- package/dist/instruction/WebXCursorImageInstruction.js +16 -0
- package/dist/instruction/WebXCursorImageInstruction.js.map +1 -0
- package/dist/instruction/WebXImageInstruction.d.ts +7 -0
- package/dist/instruction/WebXImageInstruction.js +19 -0
- package/dist/instruction/WebXImageInstruction.js.map +1 -0
- package/dist/instruction/WebXInstruction.d.ts +13 -0
- package/dist/instruction/WebXInstruction.js +34 -0
- package/dist/instruction/WebXInstruction.js.map +1 -0
- package/dist/instruction/WebXInstructionResponse.d.ts +13 -0
- package/dist/instruction/WebXInstructionResponse.js +40 -0
- package/dist/instruction/WebXInstructionResponse.js.map +1 -0
- package/dist/instruction/WebXInstructionType.d.ts +13 -0
- package/dist/instruction/WebXInstructionType.js +38 -0
- package/dist/instruction/WebXInstructionType.js.map +1 -0
- package/dist/instruction/WebXKeyboardInstruction.d.ts +10 -0
- package/dist/instruction/WebXKeyboardInstruction.js +26 -0
- package/dist/instruction/WebXKeyboardInstruction.js.map +1 -0
- package/dist/instruction/WebXMouseInstruction.d.ts +13 -0
- package/dist/instruction/WebXMouseInstruction.js +33 -0
- package/dist/instruction/WebXMouseInstruction.js.map +1 -0
- package/dist/instruction/WebXQualityInstruction.d.ts +7 -0
- package/dist/instruction/WebXQualityInstruction.js +19 -0
- package/dist/instruction/WebXQualityInstruction.js.map +1 -0
- package/dist/instruction/WebXScreenInstruction.d.ts +4 -0
- package/dist/instruction/WebXScreenInstruction.js +12 -0
- package/dist/instruction/WebXScreenInstruction.js.map +1 -0
- package/dist/instruction/WebXWindowsInstruction.d.ts +4 -0
- package/dist/instruction/WebXWindowsInstruction.js +12 -0
- package/dist/instruction/WebXWindowsInstruction.js.map +1 -0
- package/dist/instruction/index.d.ts +11 -0
- package/dist/instruction/index.js +28 -0
- package/dist/instruction/index.js.map +1 -0
- package/dist/message/WebXCursorImageMessage.d.ts +17 -0
- package/dist/message/WebXCursorImageMessage.js +36 -0
- package/dist/message/WebXCursorImageMessage.js.map +1 -0
- package/dist/message/WebXImageMessage.d.ts +15 -0
- package/dist/message/WebXImageMessage.js +32 -0
- package/dist/message/WebXImageMessage.js.map +1 -0
- package/dist/message/WebXMessage.d.ts +8 -0
- package/dist/message/WebXMessage.js +17 -0
- package/dist/message/WebXMessage.js.map +1 -0
- package/dist/message/WebXMessageType.d.ts +10 -0
- package/dist/message/WebXMessageType.js +15 -0
- package/dist/message/WebXMessageType.js.map +1 -0
- package/dist/message/WebXMouseMessage.d.ts +10 -0
- package/dist/message/WebXMouseMessage.js +24 -0
- package/dist/message/WebXMouseMessage.js.map +1 -0
- package/dist/message/WebXPollMessage.d.ts +4 -0
- package/dist/message/WebXPollMessage.js +12 -0
- package/dist/message/WebXPollMessage.js.map +1 -0
- package/dist/message/WebXScreenMessage.d.ts +12 -0
- package/dist/message/WebXScreenMessage.js +16 -0
- package/dist/message/WebXScreenMessage.js.map +1 -0
- package/dist/message/WebXSubImagesMessage.d.ts +11 -0
- package/dist/message/WebXSubImagesMessage.js +24 -0
- package/dist/message/WebXSubImagesMessage.js.map +1 -0
- package/dist/message/WebXWindowsMessage.d.ts +7 -0
- package/dist/message/WebXWindowsMessage.js +16 -0
- package/dist/message/WebXWindowsMessage.js.map +1 -0
- package/dist/message/index.d.ts +9 -0
- package/dist/message/index.js +26 -0
- package/dist/message/index.js.map +1 -0
- package/dist/tracer/WebXHandler.d.ts +3 -0
- package/dist/tracer/WebXHandler.js +3 -0
- package/dist/tracer/WebXHandler.js.map +1 -0
- package/dist/tracer/WebXInstructionHandler.d.ts +4 -0
- package/dist/tracer/WebXInstructionHandler.js +7 -0
- package/dist/tracer/WebXInstructionHandler.js.map +1 -0
- package/dist/tracer/WebXMessageHandler.d.ts +4 -0
- package/dist/tracer/WebXMessageHandler.js +7 -0
- package/dist/tracer/WebXMessageHandler.js.map +1 -0
- package/dist/tracer/WebXStatsHandler.d.ts +7 -0
- package/dist/tracer/WebXStatsHandler.js +7 -0
- package/dist/tracer/WebXStatsHandler.js.map +1 -0
- package/dist/tracer/index.d.ts +4 -0
- package/dist/tracer/index.js +21 -0
- package/dist/tracer/index.js.map +1 -0
- package/dist/transport/WebXBinarySerializer.d.ts +11 -0
- package/dist/transport/WebXBinarySerializer.js +43 -0
- package/dist/transport/WebXBinarySerializer.js.map +1 -0
- package/dist/transport/WebXInstructionBuffer.d.ts +35 -0
- package/dist/transport/WebXInstructionBuffer.js +80 -0
- package/dist/transport/WebXInstructionBuffer.js.map +1 -0
- package/dist/transport/WebXInstructionEncoder.d.ts +101 -0
- package/dist/transport/WebXInstructionEncoder.js +175 -0
- package/dist/transport/WebXInstructionEncoder.js.map +1 -0
- package/dist/transport/WebXMessageBuffer.d.ts +19 -0
- package/dist/transport/WebXMessageBuffer.js +58 -0
- package/dist/transport/WebXMessageBuffer.js.map +1 -0
- package/dist/transport/WebXMessageDecoder.d.ts +16 -0
- package/dist/transport/WebXMessageDecoder.js +156 -0
- package/dist/transport/WebXMessageDecoder.js.map +1 -0
- package/dist/transport/index.d.ts +5 -0
- package/dist/transport/index.js +22 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/tunnel/WebXDefaultQoSHandler.d.ts +16 -0
- package/dist/tunnel/WebXDefaultQoSHandler.js +57 -0
- package/dist/tunnel/WebXDefaultQoSHandler.js.map +1 -0
- package/dist/tunnel/WebXQoSHandler.d.ts +6 -0
- package/dist/tunnel/WebXQoSHandler.js +7 -0
- package/dist/tunnel/WebXQoSHandler.js.map +1 -0
- package/dist/tunnel/WebXSocketIOTunnel.d.ts +15 -0
- package/dist/tunnel/WebXSocketIOTunnel.js +41 -0
- package/dist/tunnel/WebXSocketIOTunnel.js.map +1 -0
- package/dist/tunnel/WebXTunnel.d.ts +24 -0
- package/dist/tunnel/WebXTunnel.js +106 -0
- package/dist/tunnel/WebXTunnel.js.map +1 -0
- package/dist/tunnel/WebXWebSocketTunnel.d.ts +12 -0
- package/dist/tunnel/WebXWebSocketTunnel.js +41 -0
- package/dist/tunnel/WebXWebSocketTunnel.js.map +1 -0
- package/dist/tunnel/index.d.ts +5 -0
- package/dist/tunnel/index.js +22 -0
- package/dist/tunnel/index.js.map +1 -0
- package/dist/utils/Config.d.ts +4 -0
- package/dist/utils/Config.js +10 -0
- package/dist/utils/Config.js.map +1 -0
- package/dist/utils/WebXAsyncExec.d.ts +5 -0
- package/dist/utils/WebXAsyncExec.js +18 -0
- package/dist/utils/WebXAsyncExec.js.map +1 -0
- package/dist/utils/WebXColourGenerator.d.ts +5 -0
- package/dist/utils/WebXColourGenerator.js +27 -0
- package/dist/utils/WebXColourGenerator.js.map +1 -0
- package/dist/utils/WebXFileSize.d.ts +3 -0
- package/dist/utils/WebXFileSize.js +14 -0
- package/dist/utils/WebXFileSize.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +21 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { WebXInstruction } from '../instruction';
|
|
2
|
+
import { WebXMessage } from '../message';
|
|
3
|
+
import { WebXBinarySerializer } from '../transport';
|
|
4
|
+
import { WebXQoSHandler } from './WebXQoSHandler';
|
|
5
|
+
export declare abstract class WebXTunnel {
|
|
6
|
+
protected _serializer: WebXBinarySerializer;
|
|
7
|
+
private _qosHandler;
|
|
8
|
+
private _instructionResponses;
|
|
9
|
+
protected constructor();
|
|
10
|
+
abstract connect(data: any, serializer: WebXBinarySerializer): Promise<Event>;
|
|
11
|
+
abstract disconnect(): void;
|
|
12
|
+
abstract send(data: ArrayBuffer): void;
|
|
13
|
+
sendInstruction(command: WebXInstruction): void;
|
|
14
|
+
sendRequest(command: WebXInstruction, timeout?: number): Promise<WebXMessage>;
|
|
15
|
+
protected onMessage(data: ArrayBuffer): Promise<void>;
|
|
16
|
+
handleMessage(message: WebXMessage): void;
|
|
17
|
+
handleReceivedBytes(data: ArrayBuffer): void;
|
|
18
|
+
handleSentBytes(data: ArrayBuffer): void;
|
|
19
|
+
handleClose(event: CloseEvent): void;
|
|
20
|
+
onClosed(): void;
|
|
21
|
+
isConnected(): boolean;
|
|
22
|
+
setQoSHandler(qosHandler: WebXQoSHandler): void;
|
|
23
|
+
getQoSHandler(): WebXQoSHandler;
|
|
24
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.WebXTunnel = void 0;
|
|
13
|
+
const instruction_1 = require("../instruction");
|
|
14
|
+
const transport_1 = require("../transport");
|
|
15
|
+
const WebXDefaultQoSHandler_1 = require("./WebXDefaultQoSHandler");
|
|
16
|
+
class WebXTunnel {
|
|
17
|
+
constructor() {
|
|
18
|
+
this._qosHandler = new WebXDefaultQoSHandler_1.WebXDefaultQoSHandler(this);
|
|
19
|
+
this._instructionResponses = new Map();
|
|
20
|
+
this._serializer = null;
|
|
21
|
+
}
|
|
22
|
+
sendInstruction(command) {
|
|
23
|
+
// console.log(`Sending command: `, command);
|
|
24
|
+
const message = this._serializer.serializeInstruction(command);
|
|
25
|
+
this.send(message);
|
|
26
|
+
}
|
|
27
|
+
sendRequest(command, timeout) {
|
|
28
|
+
// console.log(`Sending request: `, command);
|
|
29
|
+
command.synchronous = true;
|
|
30
|
+
timeout = timeout || 10000;
|
|
31
|
+
const response = new instruction_1.WebXInstructionResponse(command, timeout);
|
|
32
|
+
this._instructionResponses.set(command.id, response);
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
const message = this._serializer.serializeInstruction(command);
|
|
35
|
+
this.send(message);
|
|
36
|
+
response
|
|
37
|
+
.then(resolve)
|
|
38
|
+
.catch((error) => {
|
|
39
|
+
this._instructionResponses.delete(command.id);
|
|
40
|
+
reject(error);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
onMessage(data) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
this.handleReceivedBytes(data);
|
|
47
|
+
if (data.byteLength === 0) {
|
|
48
|
+
console.warn('Got a zero length message');
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
else if (data.byteLength < 32) {
|
|
52
|
+
console.warn('Message does not contain a valid header');
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const buffer = new transport_1.WebXMessageBuffer(data);
|
|
56
|
+
this._qosHandler.handle(buffer.messageQueueLength);
|
|
57
|
+
const message = yield this._serializer.deserializeMessage(buffer);
|
|
58
|
+
if (message != null) {
|
|
59
|
+
// Handle any blocking requests
|
|
60
|
+
if (message.commandId != null && this._instructionResponses.get(message.commandId) != null) {
|
|
61
|
+
const instructionResponse = this._instructionResponses.get(message.commandId);
|
|
62
|
+
this._instructionResponses.delete(message.commandId);
|
|
63
|
+
instructionResponse.resolve(message);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
// Send async message
|
|
67
|
+
this.handleMessage(message);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
// eslint-disable-next-line
|
|
73
|
+
handleMessage(message) {
|
|
74
|
+
throw new Error('Method not implemented.');
|
|
75
|
+
}
|
|
76
|
+
// eslint-disable-next-line
|
|
77
|
+
handleReceivedBytes(data) {
|
|
78
|
+
throw new Error('Method not implemented.');
|
|
79
|
+
}
|
|
80
|
+
// eslint-disable-next-line
|
|
81
|
+
handleSentBytes(data) {
|
|
82
|
+
throw new Error('Method not implemented');
|
|
83
|
+
}
|
|
84
|
+
// eslint-disable-next-line
|
|
85
|
+
handleClose(event) {
|
|
86
|
+
// Clear all pending instruction responses
|
|
87
|
+
this._instructionResponses.forEach((response) => {
|
|
88
|
+
response.reject('Tunnel closed');
|
|
89
|
+
});
|
|
90
|
+
this.onClosed();
|
|
91
|
+
}
|
|
92
|
+
onClosed() {
|
|
93
|
+
console.log(`Websocket closed`);
|
|
94
|
+
}
|
|
95
|
+
isConnected() {
|
|
96
|
+
throw new Error('Method not implemented.');
|
|
97
|
+
}
|
|
98
|
+
setQoSHandler(qosHandler) {
|
|
99
|
+
this._qosHandler = qosHandler;
|
|
100
|
+
}
|
|
101
|
+
getQoSHandler() {
|
|
102
|
+
return this._qosHandler;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.WebXTunnel = WebXTunnel;
|
|
106
|
+
//# sourceMappingURL=WebXTunnel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebXTunnel.js","sourceRoot":"","sources":["../../src/tunnel/WebXTunnel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA0E;AAE1E,4CAAuE;AAEvE,mEAAgE;AAEhE,MAAsB,UAAU;IAM9B;QAJQ,gBAAW,GAAmB,IAAI,6CAAqB,CAAC,IAAI,CAAC,CAAC;QAE9D,0BAAqB,GAA8C,IAAI,GAAG,EAAwC,CAAC;QAGzH,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IAQD,eAAe,CAAC,OAAwB;QACtC,6CAA6C;QAC7C,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAC/D,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAED,WAAW,CAAC,OAAwB,EAAE,OAAgB;QACpD,6CAA6C;QAC7C,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;QAC3B,OAAO,GAAG,OAAO,IAAI,KAAK,CAAC;QAC3B,MAAM,QAAQ,GAAG,IAAI,qCAAuB,CAAc,OAAO,EA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,CAAC,WAAW,CAAC;IAC1B,CAAC;CAEF;AA9GD,gCA8GC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WebXTunnel } from './WebXTunnel';
|
|
2
|
+
import { WebXBinarySerializer } from '../transport';
|
|
3
|
+
export declare class WebXWebSocketTunnel extends WebXTunnel {
|
|
4
|
+
private readonly _url;
|
|
5
|
+
private _socket;
|
|
6
|
+
private _connectionOptions;
|
|
7
|
+
constructor(url: string, options?: any);
|
|
8
|
+
getSocket(): WebSocket;
|
|
9
|
+
send(data: ArrayBuffer): void;
|
|
10
|
+
connect(data: any, serializer: WebXBinarySerializer): Promise<Event>;
|
|
11
|
+
disconnect(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebXWebSocketTunnel = void 0;
|
|
4
|
+
const WebXTunnel_1 = require("./WebXTunnel");
|
|
5
|
+
class WebXWebSocketTunnel extends WebXTunnel_1.WebXTunnel {
|
|
6
|
+
constructor(url, options = {}) {
|
|
7
|
+
super();
|
|
8
|
+
this._connectionOptions = options;
|
|
9
|
+
this._url = url;
|
|
10
|
+
}
|
|
11
|
+
getSocket() {
|
|
12
|
+
return this._socket;
|
|
13
|
+
}
|
|
14
|
+
send(data) {
|
|
15
|
+
this._socket.send(data);
|
|
16
|
+
this.handleSentBytes(data);
|
|
17
|
+
}
|
|
18
|
+
connect(data, serializer) {
|
|
19
|
+
const options = Object.assign(Object.assign({}, this._connectionOptions), data);
|
|
20
|
+
const parameters = new URLSearchParams(options);
|
|
21
|
+
const url = `${this._url}?${parameters}`;
|
|
22
|
+
this._serializer = serializer;
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
this._socket = new WebSocket(url);
|
|
25
|
+
this._socket.binaryType = 'arraybuffer';
|
|
26
|
+
this._socket.onopen = () => {
|
|
27
|
+
resolve(null);
|
|
28
|
+
};
|
|
29
|
+
this._socket.onerror = (event) => reject(event);
|
|
30
|
+
this._socket.onclose = this.handleClose.bind(this);
|
|
31
|
+
this._socket.onmessage = (aMessage) => this.onMessage(aMessage.data);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
disconnect() {
|
|
35
|
+
if (this._socket) {
|
|
36
|
+
this._socket.close();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.WebXWebSocketTunnel = WebXWebSocketTunnel;
|
|
41
|
+
//# sourceMappingURL=WebXWebSocketTunnel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebXWebSocketTunnel.js","sourceRoot":"","sources":["../../src/tunnel/WebXWebSocketTunnel.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAG1C,MAAa,mBAAoB,SAAQ,uBAAU;IAKjD,YAAY,GAAW,EAAE,UAAe,EAAE;QACxC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,IAAiB;QACpB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,CAAC,IAAS,EAAE,UAAgC;QACjD,MAAM,OAAO,mCAAO,IAAI,CAAC,kBAAkB,GAAK,IAAI,CAAC,CAAC;QACtD,MAAM,UAAU,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;QAChD,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,IAAI,UAAU,EAAE,CAAC;QAEzC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,OAAO,GAAG,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,aAAa,CAAC;YACxC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE;gBACzB,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,CAAC,KAAY,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvD,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnD,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,CAAC,QAAa,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC5E,CAAC,CAAC,CAAC;IACL,CAAC;IAED,UAAU;QACR,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;SACrB;IACH,CAAC;CAEF;AA5CD,kDA4CC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./WebXTunnel"), exports);
|
|
18
|
+
__exportStar(require("./WebXWebSocketTunnel"), exports);
|
|
19
|
+
__exportStar(require("./WebXSocketIOTunnel"), exports);
|
|
20
|
+
__exportStar(require("./WebXQoSHandler"), exports);
|
|
21
|
+
__exportStar(require("./WebXDefaultQoSHandler"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tunnel/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,wDAAsC;AACtC,uDAAqC;AACrC,mDAAiC;AACjC,0DAAwC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/utils/Config.ts"],"names":[],"mappings":";;;AAIA,SAAgB,UAAU;IACxB,OAAO;QACL,sBAAsB,EAAE,KAAK;KAC9B,CAAC;AACJ,CAAC;AAJD,gCAIC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebXAsyncExec = void 0;
|
|
4
|
+
class WebXAsyncExec {
|
|
5
|
+
constructor(_func) {
|
|
6
|
+
this._func = _func;
|
|
7
|
+
}
|
|
8
|
+
exec(...args) {
|
|
9
|
+
return new Promise((resolve) => {
|
|
10
|
+
setTimeout(() => {
|
|
11
|
+
this._func(...args);
|
|
12
|
+
resolve();
|
|
13
|
+
}, 0);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.WebXAsyncExec = WebXAsyncExec;
|
|
18
|
+
//# sourceMappingURL=WebXAsyncExec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebXAsyncExec.js","sourceRoot":"","sources":["../../src/utils/WebXAsyncExec.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAa;IAExB,YAAoB,KAA+B;QAA/B,UAAK,GAAL,KAAK,CAA0B;IACnD,CAAC;IAEM,IAAI,CAAC,GAAG,IAAW;QACxB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;gBAEpB,OAAO,EAAE,CAAC;YACZ,CAAC,EAAE,CAAC,CAAC,CAAC;QACR,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAdD,sCAcC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebXColourGenerator = void 0;
|
|
4
|
+
class WebXColourGenerator {
|
|
5
|
+
static randomColour() {
|
|
6
|
+
const index = Math.floor(Math.random() * WebXColourGenerator._COLOURS.length);
|
|
7
|
+
return WebXColourGenerator._COLOURS[index];
|
|
8
|
+
}
|
|
9
|
+
static indexedColour(index) {
|
|
10
|
+
index = index % WebXColourGenerator._COLOURS.length;
|
|
11
|
+
return WebXColourGenerator._COLOURS[index];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.WebXColourGenerator = WebXColourGenerator;
|
|
15
|
+
WebXColourGenerator._COLOURS = [
|
|
16
|
+
'#FF6633', '#FFB399', '#FF33FF', '#FFFF99', '#00B3E6',
|
|
17
|
+
'#E6B333', '#3366E6', '#999966', '#99FF99', '#B34D4D',
|
|
18
|
+
'#80B300', '#809900', '#E6B3B3', '#6680B3', '#66991A',
|
|
19
|
+
'#FF99E6', '#CCFF1A', '#FF1A66', '#E6331A', '#33FFCC',
|
|
20
|
+
'#66994D', '#B366CC', '#4D8000', '#B33300', '#CC80CC',
|
|
21
|
+
'#66664D', '#991AFF', '#E666FF', '#4DB3FF', '#1AB399',
|
|
22
|
+
'#E666B3', '#33991A', '#CC9999', '#B3B31A', '#00E680',
|
|
23
|
+
'#4D8066', '#809980', '#E6FF80', '#1AFF33', '#999933',
|
|
24
|
+
'#FF3380', '#CCCC00', '#66E64D', '#4D80CC', '#9900B3',
|
|
25
|
+
'#E64D66', '#4DB380', '#FF4D4D', '#99E6E6', '#6666FF'
|
|
26
|
+
];
|
|
27
|
+
//# sourceMappingURL=WebXColourGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebXColourGenerator.js","sourceRoot":"","sources":["../../src/utils/WebXColourGenerator.ts"],"names":[],"mappings":";;;AAAA,MAAa,mBAAmB;IAerB,MAAM,CAAC,YAAY;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,mBAAmB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC9E,OAAO,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IAEM,MAAM,CAAC,aAAa,CAAC,KAAa;QACvC,KAAK,GAAG,KAAK,GAAG,mBAAmB,CAAC,QAAQ,CAAC,MAAM,CAAC;QACpD,OAAO,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;;AAvBL,kDA0BC;AAxBgB,4BAAQ,GAAG;IACxB,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;CACtD,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebXFileSize = void 0;
|
|
4
|
+
class WebXFileSize {
|
|
5
|
+
static humanFileSize(bytes) {
|
|
6
|
+
if (bytes === 0) {
|
|
7
|
+
return "0.00B";
|
|
8
|
+
}
|
|
9
|
+
const e = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
10
|
+
return (bytes / Math.pow(1024, e)).toFixed(2) + ' KMGTP'.charAt(e) + 'B';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.WebXFileSize = WebXFileSize;
|
|
14
|
+
//# sourceMappingURL=WebXFileSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebXFileSize.js","sourceRoot":"","sources":["../../src/utils/WebXFileSize.ts"],"names":[],"mappings":";;;AAAA,MAAa,YAAY;IACrB,MAAM,CAAC,aAAa,CAAC,KAAa;QAC9B,IAAI,KAAK,KAAK,CAAC,EAAE;YACf,OAAO,OAAO,CAAC;SAChB;QACD,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QACvD,OAAO,CAAC,KAAK,GAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,GAAC,GAAG,CAAC;IACvE,CAAC;CACJ;AARD,oCAQC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Config"), exports);
|
|
18
|
+
__exportStar(require("./WebXAsyncExec"), exports);
|
|
19
|
+
__exportStar(require("./WebXColourGenerator"), exports);
|
|
20
|
+
__exportStar(require("./WebXFileSize"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,kDAAgC;AAChC,wDAAsC;AACtC,iDAA+B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@illgrenoble/webx-client",
|
|
3
|
+
"description": "Client javascript library to display WebX remote desktop in a browser.",
|
|
4
|
+
"version": "0.1.1",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"lint": "eslint . --ext .ts",
|
|
7
|
+
"lint:fix": "eslint . --ext .ts --fix",
|
|
8
|
+
"build": "tsc"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"webx"
|
|
12
|
+
],
|
|
13
|
+
"main": "dist/index.js",
|
|
14
|
+
"typings": "dist/index.d.ts",
|
|
15
|
+
"module": "",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/ILLGrenoble/webx-client.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "GPL-3.0",
|
|
21
|
+
"author": "Stuart Caunt <caunt@ill.fr>",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/socket.io-client": "^1.4.36",
|
|
29
|
+
"@types/three": "^0.133.0",
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
31
|
+
"@typescript-eslint/parser": "^4.33.0",
|
|
32
|
+
"buffer": "^6.0.3",
|
|
33
|
+
"eslint": "^7.32.0",
|
|
34
|
+
"prettier": "^2.4.1",
|
|
35
|
+
"ts-loader": "^9.2.6",
|
|
36
|
+
"typescript": "^4.4.3"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@tweenjs/tween.js": "^18.6.4",
|
|
40
|
+
"socket.io-client": "^2.5.0",
|
|
41
|
+
"three": "^0.133.1"
|
|
42
|
+
}
|
|
43
|
+
}
|