@illgrenoble/webx-client 1.9.2 → 1.9.4
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/dist/input/GuacamoleKeyboard.js +118 -99
- package/dist/input/WebXKeyboard.d.ts +0 -16
- package/dist/input/WebXKeyboard.js +3 -27
- package/dist/input/WebXKeyboard.js.map +1 -1
- package/package.json +1 -1
- package/dist/display/WebXMaterialProvider.d.ts +0 -8
- package/dist/display/WebXMaterialProvider.js +0 -71
- package/dist/display/WebXMaterialProvider.js.map +0 -1
- package/dist/input/WebXNewKeyboard.d.ts +0 -62
- package/dist/input/WebXNewKeyboard.js +0 -94
- package/dist/input/WebXNewKeyboard.js.map +0 -1
- package/dist/input/keyboard/WebXKeyEvent.d.ts +0 -79
- package/dist/input/keyboard/WebXKeyEvent.js +0 -324
- package/dist/input/keyboard/WebXKeyEvent.js.map +0 -1
- package/dist/input/keyboard/WebXKeyPressEvent.d.ts +0 -30
- package/dist/input/keyboard/WebXKeyPressEvent.js +0 -44
- package/dist/input/keyboard/WebXKeyPressEvent.js.map +0 -1
- package/dist/input/keyboard/WebXKeyUpEvent.d.ts +0 -33
- package/dist/input/keyboard/WebXKeyUpEvent.js +0 -31
- package/dist/input/keyboard/WebXKeyUpEvent.js.map +0 -1
- package/dist/input/keyboard/WebXKeyboardModifierState.d.ts +0 -108
- package/dist/input/keyboard/WebXKeyboardModifierState.js +0 -148
- package/dist/input/keyboard/WebXKeyboardModifierState.js.map +0 -1
- package/dist/input/keyboard/WebXKeyboardUtils.d.ts +0 -25
- package/dist/input/keyboard/WebXKeyboardUtils.js +0 -63
- package/dist/input/keyboard/WebXKeyboardUtils.js.map +0 -1
- package/dist/input/keyboard/WebXKeydownEvent.d.ts +0 -46
- package/dist/input/keyboard/WebXKeydownEvent.js +0 -66
- package/dist/input/keyboard/WebXKeydownEvent.js.map +0 -1
- package/dist/input/keyboard/index.d.ts +0 -6
- package/dist/input/keyboard/index.js +0 -23
- package/dist/input/keyboard/index.js.map +0 -1
- package/dist/lib/GuacamoleKeyboard.js +0 -1290
- package/dist/lib/GuacamoleKeyboard.js.map +0 -1
- package/dist/message/WebXPollMessage.d.ts +0 -4
- package/dist/message/WebXPollMessage.js +0 -12
- package/dist/message/WebXPollMessage.js.map +0 -1
- package/dist/src/WebXClient.d.ts +0 -261
- package/dist/src/WebXClient.js +0 -571
- package/dist/src/WebXClient.js.map +0 -1
- package/dist/src/WebXEngine.d.ts +0 -4
- package/dist/src/WebXEngine.js +0 -7
- package/dist/src/WebXEngine.js.map +0 -1
- package/dist/src/display/WebXCursor.d.ts +0 -88
- package/dist/src/display/WebXCursor.js +0 -150
- package/dist/src/display/WebXCursor.js.map +0 -1
- package/dist/src/display/WebXCursorFactory.d.ts +0 -36
- package/dist/src/display/WebXCursorFactory.js +0 -59
- package/dist/src/display/WebXCursorFactory.js.map +0 -1
- package/dist/src/display/WebXDisplay.d.ts +0 -226
- package/dist/src/display/WebXDisplay.js +0 -424
- package/dist/src/display/WebXDisplay.js.map +0 -1
- package/dist/src/display/WebXMaterial.d.ts +0 -14
- package/dist/src/display/WebXMaterial.js +0 -140
- package/dist/src/display/WebXMaterial.js.map +0 -1
- package/dist/src/display/WebXSubImage.d.ts +0 -50
- package/dist/src/display/WebXSubImage.js +0 -26
- package/dist/src/display/WebXSubImage.js.map +0 -1
- package/dist/src/display/WebXTextureFactory.d.ts +0 -54
- package/dist/src/display/WebXTextureFactory.js +0 -160
- package/dist/src/display/WebXTextureFactory.js.map +0 -1
- package/dist/src/display/WebXWindow.d.ts +0 -241
- package/dist/src/display/WebXWindow.js +0 -438
- package/dist/src/display/WebXWindow.js.map +0 -1
- package/dist/src/display/WebXWindowProperties.d.ts +0 -44
- package/dist/src/display/WebXWindowProperties.js +0 -25
- package/dist/src/display/WebXWindowProperties.js.map +0 -1
- package/dist/src/display/index.d.ts +0 -7
- package/dist/src/display/index.js +0 -24
- package/dist/src/display/index.js.map +0 -1
- package/dist/src/index.d.ts +0 -7
- package/dist/src/index.js +0 -24
- package/dist/src/index.js.map +0 -1
- package/dist/src/input/WebXKeyboard.d.ts +0 -265
- package/dist/src/input/WebXKeyboard.js +0 -632
- package/dist/src/input/WebXKeyboard.js.map +0 -1
- package/dist/src/input/WebXMouse.d.ts +0 -125
- package/dist/src/input/WebXMouse.js +0 -231
- package/dist/src/input/WebXMouse.js.map +0 -1
- package/dist/src/input/index.d.ts +0 -4
- package/dist/src/input/index.js +0 -21
- package/dist/src/input/index.js.map +0 -1
- package/dist/src/input/keyboard/WebXKeyEvent.d.ts +0 -79
- package/dist/src/input/keyboard/WebXKeyEvent.js +0 -324
- package/dist/src/input/keyboard/WebXKeyEvent.js.map +0 -1
- package/dist/src/input/keyboard/WebXKeyPressEvent.d.ts +0 -30
- package/dist/src/input/keyboard/WebXKeyPressEvent.js +0 -44
- package/dist/src/input/keyboard/WebXKeyPressEvent.js.map +0 -1
- package/dist/src/input/keyboard/WebXKeyUpEvent.d.ts +0 -33
- package/dist/src/input/keyboard/WebXKeyUpEvent.js +0 -31
- package/dist/src/input/keyboard/WebXKeyUpEvent.js.map +0 -1
- package/dist/src/input/keyboard/WebXKeyboardModifierState.d.ts +0 -108
- package/dist/src/input/keyboard/WebXKeyboardModifierState.js +0 -148
- package/dist/src/input/keyboard/WebXKeyboardModifierState.js.map +0 -1
- package/dist/src/input/keyboard/WebXKeyboardUtils.d.ts +0 -25
- package/dist/src/input/keyboard/WebXKeyboardUtils.js +0 -63
- package/dist/src/input/keyboard/WebXKeyboardUtils.js.map +0 -1
- package/dist/src/input/keyboard/WebXKeydownEvent.d.ts +0 -46
- package/dist/src/input/keyboard/WebXKeydownEvent.js +0 -66
- package/dist/src/input/keyboard/WebXKeydownEvent.js.map +0 -1
- package/dist/src/input/keyboard/index.d.ts +0 -6
- package/dist/src/input/keyboard/index.js +0 -23
- package/dist/src/input/keyboard/index.js.map +0 -1
- package/dist/src/input/mouse/WebXMouseState.d.ts +0 -190
- package/dist/src/input/mouse/WebXMouseState.js +0 -217
- package/dist/src/input/mouse/WebXMouseState.js.map +0 -1
- package/dist/src/input/mouse/index.d.ts +0 -1
- package/dist/src/input/mouse/index.js +0 -18
- package/dist/src/input/mouse/index.js.map +0 -1
- package/dist/src/instruction/WebXClipboardInstruction.d.ts +0 -18
- package/dist/src/instruction/WebXClipboardInstruction.js +0 -23
- package/dist/src/instruction/WebXClipboardInstruction.js.map +0 -1
- package/dist/src/instruction/WebXConnectInstruction.d.ts +0 -19
- package/dist/src/instruction/WebXConnectInstruction.js +0 -24
- package/dist/src/instruction/WebXConnectInstruction.js.map +0 -1
- package/dist/src/instruction/WebXCursorImageInstruction.d.ts +0 -18
- package/dist/src/instruction/WebXCursorImageInstruction.js +0 -23
- package/dist/src/instruction/WebXCursorImageInstruction.js.map +0 -1
- package/dist/src/instruction/WebXDataAckInstruction.d.ts +0 -25
- package/dist/src/instruction/WebXDataAckInstruction.js +0 -26
- package/dist/src/instruction/WebXDataAckInstruction.js.map +0 -1
- package/dist/src/instruction/WebXImageInstruction.d.ts +0 -18
- package/dist/src/instruction/WebXImageInstruction.js +0 -23
- package/dist/src/instruction/WebXImageInstruction.js.map +0 -1
- package/dist/src/instruction/WebXInstruction.d.ts +0 -29
- package/dist/src/instruction/WebXInstruction.js +0 -28
- package/dist/src/instruction/WebXInstruction.js.map +0 -1
- package/dist/src/instruction/WebXInstructionResponse.d.ts +0 -66
- package/dist/src/instruction/WebXInstructionResponse.js +0 -78
- package/dist/src/instruction/WebXInstructionResponse.js.map +0 -1
- package/dist/src/instruction/WebXInstructionType.d.ts +0 -63
- package/dist/src/instruction/WebXInstructionType.js +0 -96
- package/dist/src/instruction/WebXInstructionType.js.map +0 -1
- package/dist/src/instruction/WebXKeyboardInstruction.d.ts +0 -23
- package/dist/src/instruction/WebXKeyboardInstruction.js +0 -25
- package/dist/src/instruction/WebXKeyboardInstruction.js.map +0 -1
- package/dist/src/instruction/WebXMouseInstruction.d.ts +0 -28
- package/dist/src/instruction/WebXMouseInstruction.js +0 -27
- package/dist/src/instruction/WebXMouseInstruction.js.map +0 -1
- package/dist/src/instruction/WebXPongInstruction.d.ts +0 -18
- package/dist/src/instruction/WebXPongInstruction.js +0 -23
- package/dist/src/instruction/WebXPongInstruction.js.map +0 -1
- package/dist/src/instruction/WebXQualityInstruction.d.ts +0 -19
- package/dist/src/instruction/WebXQualityInstruction.js +0 -24
- package/dist/src/instruction/WebXQualityInstruction.js.map +0 -1
- package/dist/src/instruction/WebXScreenInstruction.d.ts +0 -12
- package/dist/src/instruction/WebXScreenInstruction.js +0 -20
- package/dist/src/instruction/WebXScreenInstruction.js.map +0 -1
- package/dist/src/instruction/WebXShapeInstruction.d.ts +0 -18
- package/dist/src/instruction/WebXShapeInstruction.js +0 -23
- package/dist/src/instruction/WebXShapeInstruction.js.map +0 -1
- package/dist/src/instruction/WebXWindowsInstruction.d.ts +0 -13
- package/dist/src/instruction/WebXWindowsInstruction.js +0 -21
- package/dist/src/instruction/WebXWindowsInstruction.js.map +0 -1
- package/dist/src/instruction/index.d.ts +0 -15
- package/dist/src/instruction/index.js +0 -32
- package/dist/src/instruction/index.js.map +0 -1
- package/dist/src/message/WebXClipboardMessage.d.ts +0 -19
- package/dist/src/message/WebXClipboardMessage.js +0 -23
- package/dist/src/message/WebXClipboardMessage.js.map +0 -1
- package/dist/src/message/WebXConnectionMessage.d.ts +0 -12
- package/dist/src/message/WebXConnectionMessage.js +0 -20
- package/dist/src/message/WebXConnectionMessage.js.map +0 -1
- package/dist/src/message/WebXCursorImageMessage.d.ts +0 -46
- package/dist/src/message/WebXCursorImageMessage.js +0 -35
- package/dist/src/message/WebXCursorImageMessage.js.map +0 -1
- package/dist/src/message/WebXImageMessage.d.ts +0 -41
- package/dist/src/message/WebXImageMessage.js +0 -33
- package/dist/src/message/WebXImageMessage.js.map +0 -1
- package/dist/src/message/WebXMessage.d.ts +0 -24
- package/dist/src/message/WebXMessage.js +0 -23
- package/dist/src/message/WebXMessage.js.map +0 -1
- package/dist/src/message/WebXMessageType.d.ts +0 -59
- package/dist/src/message/WebXMessageType.js +0 -64
- package/dist/src/message/WebXMessageType.js.map +0 -1
- package/dist/src/message/WebXMouseMessage.d.ts +0 -30
- package/dist/src/message/WebXMouseMessage.js +0 -29
- package/dist/src/message/WebXMouseMessage.js.map +0 -1
- package/dist/src/message/WebXNopMessage.d.ts +0 -10
- package/dist/src/message/WebXNopMessage.js +0 -18
- package/dist/src/message/WebXNopMessage.js.map +0 -1
- package/dist/src/message/WebXPingMessage.d.ts +0 -13
- package/dist/src/message/WebXPingMessage.js +0 -21
- package/dist/src/message/WebXPingMessage.js.map +0 -1
- package/dist/src/message/WebXQualityMessage.d.ts +0 -39
- package/dist/src/message/WebXQualityMessage.js +0 -32
- package/dist/src/message/WebXQualityMessage.js.map +0 -1
- package/dist/src/message/WebXScreenMessage.d.ts +0 -37
- package/dist/src/message/WebXScreenMessage.js +0 -29
- package/dist/src/message/WebXScreenMessage.js.map +0 -1
- package/dist/src/message/WebXShapeMessage.d.ts +0 -31
- package/dist/src/message/WebXShapeMessage.js +0 -29
- package/dist/src/message/WebXShapeMessage.js.map +0 -1
- package/dist/src/message/WebXSubImagesMessage.d.ts +0 -31
- package/dist/src/message/WebXSubImagesMessage.js +0 -29
- package/dist/src/message/WebXSubImagesMessage.js.map +0 -1
- package/dist/src/message/WebXWindowsMessage.d.ts +0 -21
- package/dist/src/message/WebXWindowsMessage.js +0 -25
- package/dist/src/message/WebXWindowsMessage.js.map +0 -1
- package/dist/src/message/index.d.ts +0 -14
- package/dist/src/message/index.js +0 -31
- package/dist/src/message/index.js.map +0 -1
- package/dist/src/tracer/WebXDebugImageMessageHandler.d.ts +0 -48
- package/dist/src/tracer/WebXDebugImageMessageHandler.js +0 -102
- package/dist/src/tracer/WebXDebugImageMessageHandler.js.map +0 -1
- package/dist/src/tracer/WebXHandler.d.ts +0 -14
- package/dist/src/tracer/WebXHandler.js +0 -3
- package/dist/src/tracer/WebXHandler.js.map +0 -1
- package/dist/src/tracer/WebXInstructionHandler.d.ts +0 -21
- package/dist/src/tracer/WebXInstructionHandler.js +0 -13
- package/dist/src/tracer/WebXInstructionHandler.js.map +0 -1
- package/dist/src/tracer/WebXMessageHandler.d.ts +0 -21
- package/dist/src/tracer/WebXMessageHandler.js +0 -13
- package/dist/src/tracer/WebXMessageHandler.js.map +0 -1
- package/dist/src/tracer/WebXStatsHandler.d.ts +0 -23
- package/dist/src/tracer/WebXStatsHandler.js +0 -13
- package/dist/src/tracer/WebXStatsHandler.js.map +0 -1
- package/dist/src/tracer/index.d.ts +0 -5
- package/dist/src/tracer/index.js +0 -22
- package/dist/src/tracer/index.js.map +0 -1
- package/dist/src/transport/WebXBinarySerializer.d.ts +0 -31
- package/dist/src/transport/WebXBinarySerializer.js +0 -63
- package/dist/src/transport/WebXBinarySerializer.js.map +0 -1
- package/dist/src/transport/WebXInstructionBuffer.d.ts +0 -55
- package/dist/src/transport/WebXInstructionBuffer.js +0 -109
- package/dist/src/transport/WebXInstructionBuffer.js.map +0 -1
- package/dist/src/transport/WebXInstructionEncoder.d.ts +0 -181
- package/dist/src/transport/WebXInstructionEncoder.js +0 -294
- package/dist/src/transport/WebXInstructionEncoder.js.map +0 -1
- package/dist/src/transport/WebXMessageBuffer.d.ts +0 -80
- package/dist/src/transport/WebXMessageBuffer.js +0 -104
- package/dist/src/transport/WebXMessageBuffer.js.map +0 -1
- package/dist/src/transport/WebXMessageDecoder.d.ts +0 -108
- package/dist/src/transport/WebXMessageDecoder.js +0 -332
- package/dist/src/transport/WebXMessageDecoder.js.map +0 -1
- package/dist/src/transport/index.d.ts +0 -5
- package/dist/src/transport/index.js +0 -22
- package/dist/src/transport/index.js.map +0 -1
- package/dist/src/tunnel/WebXTunnel.d.ts +0 -93
- package/dist/src/tunnel/WebXTunnel.js +0 -156
- package/dist/src/tunnel/WebXTunnel.js.map +0 -1
- package/dist/src/tunnel/WebXWebSocketTunnel.d.ts +0 -40
- package/dist/src/tunnel/WebXWebSocketTunnel.js +0 -88
- package/dist/src/tunnel/WebXWebSocketTunnel.js.map +0 -1
- package/dist/src/tunnel/index.d.ts +0 -2
- package/dist/src/tunnel/index.js +0 -19
- package/dist/src/tunnel/index.js.map +0 -1
- package/dist/src/utils/WebXColorGenerator.d.ts +0 -24
- package/dist/src/utils/WebXColorGenerator.js +0 -46
- package/dist/src/utils/WebXColorGenerator.js.map +0 -1
- package/dist/src/utils/WebXVersion.d.ts +0 -34
- package/dist/src/utils/WebXVersion.js +0 -25
- package/dist/src/utils/WebXVersion.js.map +0 -1
- package/dist/src/utils/index.d.ts +0 -2
- package/dist/src/utils/index.js +0 -19
- package/dist/src/utils/index.js.map +0 -1
- package/dist/tracer/DemoVisualMessageHandler.d.ts +0 -15
- package/dist/tracer/DemoVisualMessageHandler.js +0 -55
- package/dist/tracer/DemoVisualMessageHandler.js.map +0 -1
- package/dist/tracer/WebXVisualMessageHandler.d.ts +0 -15
- package/dist/tracer/WebXVisualMessageHandler.js +0 -55
- package/dist/tracer/WebXVisualMessageHandler.js.map +0 -1
- package/dist/tunnel/WebXDefaultQoSHandler.d.ts +0 -16
- package/dist/tunnel/WebXDefaultQoSHandler.js +0 -57
- package/dist/tunnel/WebXDefaultQoSHandler.js.map +0 -1
- package/dist/tunnel/WebXQoSHandler.d.ts +0 -6
- package/dist/tunnel/WebXQoSHandler.js +0 -7
- package/dist/tunnel/WebXQoSHandler.js.map +0 -1
- package/dist/tunnel/WebXSocketIOTunnel.d.ts +0 -15
- package/dist/tunnel/WebXSocketIOTunnel.js +0 -41
- package/dist/tunnel/WebXSocketIOTunnel.js.map +0 -1
- package/dist/utils/ColorGenerator.d.ts +0 -24
- package/dist/utils/ColorGenerator.js +0 -46
- package/dist/utils/ColorGenerator.js.map +0 -1
- package/dist/utils/Config.d.ts +0 -4
- package/dist/utils/Config.js +0 -10
- package/dist/utils/Config.js.map +0 -1
- package/dist/utils/WebXAsyncExec.d.ts +0 -5
- package/dist/utils/WebXAsyncExec.js +0 -18
- package/dist/utils/WebXAsyncExec.js.map +0 -1
- package/dist/utils/WebXColourGenerator.d.ts +0 -5
- package/dist/utils/WebXColourGenerator.js +0 -27
- package/dist/utils/WebXColourGenerator.js.map +0 -1
- package/dist/utils/WebXFileSize.d.ts +0 -3
- package/dist/utils/WebXFileSize.js +0 -14
- package/dist/utils/WebXFileSize.js.map +0 -1
|
@@ -1,332 +0,0 @@
|
|
|
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.WebXMessageDecoder = void 0;
|
|
13
|
-
const message_1 = require("../message");
|
|
14
|
-
const display_1 = require("../display");
|
|
15
|
-
const three_1 = require("three");
|
|
16
|
-
const utils_1 = require("../utils");
|
|
17
|
-
const WebXEngine_1 = require("../WebXEngine");
|
|
18
|
-
/**
|
|
19
|
-
* Decodes binary messages received from the WebX Engine into WebXMessage objects.
|
|
20
|
-
* This class handles various message types and converts them into their respective
|
|
21
|
-
* WebXMessage implementations.
|
|
22
|
-
*/
|
|
23
|
-
class WebXMessageDecoder {
|
|
24
|
-
/**
|
|
25
|
-
* Creates a new instance of WebXMessageDecoder.
|
|
26
|
-
*
|
|
27
|
-
* @param _textureFactory The texture factory used to create textures from image data.
|
|
28
|
-
*/
|
|
29
|
-
constructor(_textureFactory) {
|
|
30
|
-
this._textureFactory = _textureFactory;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Decodes a binary message buffer into a WebXMessage object.
|
|
34
|
-
*
|
|
35
|
-
* @param buffer The binary message buffer to decode.
|
|
36
|
-
* @returns A promise that resolves to the decoded WebXMessage.
|
|
37
|
-
*/
|
|
38
|
-
decode(buffer) {
|
|
39
|
-
const { messageTypeId } = buffer;
|
|
40
|
-
if (messageTypeId === message_1.WebXMessageType.NOP) {
|
|
41
|
-
return this._createNopMessage();
|
|
42
|
-
}
|
|
43
|
-
else if (messageTypeId === message_1.WebXMessageType.CONNECTION) {
|
|
44
|
-
return this._createConnectionMessage();
|
|
45
|
-
}
|
|
46
|
-
else if (messageTypeId === message_1.WebXMessageType.SCREEN) {
|
|
47
|
-
return this._createScreenMessage(buffer);
|
|
48
|
-
}
|
|
49
|
-
else if (messageTypeId === message_1.WebXMessageType.WINDOWS) {
|
|
50
|
-
return this._createWindowsMessage(buffer);
|
|
51
|
-
}
|
|
52
|
-
else if (messageTypeId === message_1.WebXMessageType.IMAGE) {
|
|
53
|
-
return this._createImageMessage(buffer);
|
|
54
|
-
}
|
|
55
|
-
else if (messageTypeId === message_1.WebXMessageType.SUBIMAGES) {
|
|
56
|
-
return this._createSubImagesMessage(buffer);
|
|
57
|
-
}
|
|
58
|
-
else if (messageTypeId === message_1.WebXMessageType.MOUSE) {
|
|
59
|
-
return this._createMouseMessage(buffer);
|
|
60
|
-
}
|
|
61
|
-
else if (messageTypeId === message_1.WebXMessageType.CURSOR_IMAGE) {
|
|
62
|
-
return this._createCursorImageMessage(buffer);
|
|
63
|
-
}
|
|
64
|
-
else if (messageTypeId === message_1.WebXMessageType.PING) {
|
|
65
|
-
return this._createPingMessage();
|
|
66
|
-
}
|
|
67
|
-
else if (messageTypeId === message_1.WebXMessageType.QUALITY) {
|
|
68
|
-
return this._createQualityMessage(buffer);
|
|
69
|
-
}
|
|
70
|
-
else if (messageTypeId === message_1.WebXMessageType.CLIPBOARD) {
|
|
71
|
-
return this._createClipboardMessage(buffer);
|
|
72
|
-
}
|
|
73
|
-
else if (messageTypeId === message_1.WebXMessageType.SHAPE) {
|
|
74
|
-
return this._createShapeMessage(buffer);
|
|
75
|
-
}
|
|
76
|
-
console.error(`Failed to decode message with typeId ${messageTypeId}`);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Determines the MIME type of an image based on its type string.
|
|
80
|
-
*
|
|
81
|
-
* @param imageType The image type string (e.g., 'jpg', 'png').
|
|
82
|
-
* @returns The corresponding MIME type.
|
|
83
|
-
*/
|
|
84
|
-
_determineMimeType(imageType) {
|
|
85
|
-
if (imageType.substr(0, 3) === 'jpg') {
|
|
86
|
-
return 'image/jpeg';
|
|
87
|
-
}
|
|
88
|
-
else if (imageType.substr(0, 3) === 'png') {
|
|
89
|
-
return 'image/png';
|
|
90
|
-
}
|
|
91
|
-
return 'image/bmp';
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Creates a WebXNopMessage, which is used for no-operation messages.
|
|
95
|
-
*/
|
|
96
|
-
_createNopMessage() {
|
|
97
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
return new message_1.WebXNopMessage();
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Creates a WebXConnectionMessage, which is used for connection-related messages.
|
|
103
|
-
*/
|
|
104
|
-
_createConnectionMessage() {
|
|
105
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
-
return new message_1.WebXConnectionMessage();
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Decodes a buffer into a WebXImageMessage.
|
|
111
|
-
*
|
|
112
|
-
* @param buffer The binary message buffer to decode.
|
|
113
|
-
* @returns A promise that resolves to a WebXImageMessage.
|
|
114
|
-
*/
|
|
115
|
-
_createImageMessage(buffer) {
|
|
116
|
-
return new Promise((resolve) => {
|
|
117
|
-
const commandId = buffer.getUint32();
|
|
118
|
-
const windowId = buffer.getUint32();
|
|
119
|
-
const depth = buffer.getUint32();
|
|
120
|
-
const imageType = buffer.getString(4);
|
|
121
|
-
const mimetype = this._determineMimeType(imageType);
|
|
122
|
-
const colorDataSize = buffer.getUint32();
|
|
123
|
-
const alphaDataSize = buffer.getUint32();
|
|
124
|
-
const colorData = buffer.getUint8Array(colorDataSize);
|
|
125
|
-
const alphaData = buffer.getUint8Array(alphaDataSize);
|
|
126
|
-
const colorMapPromise = this._textureFactory.createTextureFromArray(colorData, mimetype, three_1.SRGBColorSpace);
|
|
127
|
-
const alphaMapPromise = this._textureFactory.createTextureFromArray(alphaData, mimetype, three_1.LinearSRGBColorSpace);
|
|
128
|
-
Promise.all([colorMapPromise, alphaMapPromise])
|
|
129
|
-
.then(([colorMap, alphaMap]) => {
|
|
130
|
-
resolve(new message_1.WebXImageMessage(windowId, depth, colorMap, alphaMap, commandId, buffer.bufferLength));
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Decodes a buffer into a WebXSubImagesMessage containing multiple sub-images.
|
|
136
|
-
*
|
|
137
|
-
* @param buffer The binary message buffer to decode.
|
|
138
|
-
* @returns A promise that resolves to a WebXSubImagesMessage.
|
|
139
|
-
*/
|
|
140
|
-
_createSubImagesMessage(buffer) {
|
|
141
|
-
return new Promise((resolve) => {
|
|
142
|
-
const commandId = buffer.getUint32();
|
|
143
|
-
const windowId = buffer.getUint32();
|
|
144
|
-
const imagePromises = new Array();
|
|
145
|
-
const numberOfSubImages = buffer.getUint32();
|
|
146
|
-
for (let i = 0; i < numberOfSubImages; i++) {
|
|
147
|
-
const x = buffer.getInt32();
|
|
148
|
-
const y = buffer.getInt32();
|
|
149
|
-
const width = buffer.getInt32();
|
|
150
|
-
const height = buffer.getInt32();
|
|
151
|
-
const depth = buffer.getUint32();
|
|
152
|
-
const imageType = buffer.getString(4);
|
|
153
|
-
const mimetype = this._determineMimeType(imageType);
|
|
154
|
-
const colorDataSize = buffer.getUint32();
|
|
155
|
-
const alphaDataSize = buffer.getUint32();
|
|
156
|
-
const colorData = buffer.getUint8Array(colorDataSize);
|
|
157
|
-
const alphaData = buffer.getUint8Array(alphaDataSize);
|
|
158
|
-
const imagePromise = new Promise((innerResolve, innerReject) => {
|
|
159
|
-
const colorMapPromise = this._textureFactory.createTextureFromArray(colorData, mimetype, three_1.SRGBColorSpace);
|
|
160
|
-
const alphaMapPromise = this._textureFactory.createTextureFromArray(alphaData, mimetype, three_1.LinearSRGBColorSpace);
|
|
161
|
-
Promise.all([colorMapPromise, alphaMapPromise])
|
|
162
|
-
.then(([colorMap, alphaMap]) => {
|
|
163
|
-
innerResolve(new display_1.WebXSubImage({ x, y, width, height, depth, colorMap, alphaMap }));
|
|
164
|
-
})
|
|
165
|
-
.catch(innerReject);
|
|
166
|
-
});
|
|
167
|
-
imagePromises.push(imagePromise);
|
|
168
|
-
}
|
|
169
|
-
Promise.all(imagePromises).then((webXSubImages) => {
|
|
170
|
-
resolve(new message_1.WebXSubImagesMessage(windowId, webXSubImages, commandId, buffer.bufferLength));
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Decodes a buffer into a WebXMouseMessage, which contains mouse position and cursor ID.
|
|
176
|
-
*
|
|
177
|
-
* @param buffer The binary message buffer to decode.
|
|
178
|
-
* @returns A promise that resolves to a WebXMouseMessage.
|
|
179
|
-
*/
|
|
180
|
-
_createMouseMessage(buffer) {
|
|
181
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
-
const commandId = buffer.getUint32();
|
|
183
|
-
const x = buffer.getInt32();
|
|
184
|
-
const y = buffer.getInt32();
|
|
185
|
-
const cursorId = buffer.getUint32();
|
|
186
|
-
return new message_1.WebXMouseMessage(x, y, cursorId, commandId);
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Decodes a buffer into a WebXWindowsMessage, which contains information about multiple windows.
|
|
191
|
-
*
|
|
192
|
-
* @param buffer The binary message buffer to decode.
|
|
193
|
-
* @returns A promise that resolves to a WebXWindowsMessage.
|
|
194
|
-
*/
|
|
195
|
-
_createWindowsMessage(buffer) {
|
|
196
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
-
const commandId = buffer.getUint32();
|
|
198
|
-
const numberOfWindows = buffer.getUint32();
|
|
199
|
-
const windowData = new Array();
|
|
200
|
-
for (let i = 0; i < numberOfWindows; i++) {
|
|
201
|
-
const windowId = buffer.getUint32();
|
|
202
|
-
const x = buffer.getInt32();
|
|
203
|
-
const y = buffer.getInt32();
|
|
204
|
-
const width = buffer.getInt32();
|
|
205
|
-
const height = buffer.getInt32();
|
|
206
|
-
windowData.push({ id: windowId, x: x, y: y, width: width, height: height, shaped: false });
|
|
207
|
-
}
|
|
208
|
-
// Update from webx-engine 1.4.0: inclusion of list of windows that have shapes (require stencil buffer)
|
|
209
|
-
if (WebXEngine_1.WebXEngine.version.versionNumber >= 1.4 && buffer.bufferLength - buffer.readOffset >= 4) {
|
|
210
|
-
const numberOfShapedWindows = buffer.getUint32();
|
|
211
|
-
for (let i = 0; i < numberOfShapedWindows; i++) {
|
|
212
|
-
const windowId = buffer.getUint32();
|
|
213
|
-
windowData.find(window => window.id === windowId).shaped = true;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
return new message_1.WebXWindowsMessage(windowData.map(data => new display_1.WebXWindowProperties(data)), commandId);
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Decodes a buffer into a WebXCursorImageMessage, which contains cursor image data.
|
|
221
|
-
*
|
|
222
|
-
* @param buffer The binary message buffer to decode.
|
|
223
|
-
* @returns A promise that resolves to a WebXCursorImageMessage.
|
|
224
|
-
*/
|
|
225
|
-
_createCursorImageMessage(buffer) {
|
|
226
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
227
|
-
const commandId = buffer.getUint32();
|
|
228
|
-
const x = buffer.getInt32();
|
|
229
|
-
const y = buffer.getInt32();
|
|
230
|
-
const xHot = buffer.getInt32();
|
|
231
|
-
const yHot = buffer.getInt32();
|
|
232
|
-
const cursorId = buffer.getUint32();
|
|
233
|
-
const imageDataSize = buffer.getUint32();
|
|
234
|
-
const imageData = buffer.getUint8Array(imageDataSize);
|
|
235
|
-
try {
|
|
236
|
-
const texture = yield this._textureFactory.createTextureFromArray(imageData, 'image/png', three_1.SRGBColorSpace);
|
|
237
|
-
return new message_1.WebXCursorImageMessage(x, y, xHot, yHot, cursorId, texture, commandId);
|
|
238
|
-
}
|
|
239
|
-
catch (error) {
|
|
240
|
-
console.error(`Failed to get texture for cursor image: ${error}`);
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Decodes a buffer into a WebXScreenMessage, which contains screen dimensions.
|
|
246
|
-
*
|
|
247
|
-
* @param buffer The binary message buffer to decode.
|
|
248
|
-
* @returns A promise that resolves to a WebXScreenMessage.
|
|
249
|
-
*/
|
|
250
|
-
_createScreenMessage(buffer) {
|
|
251
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
252
|
-
const commandId = buffer.getUint32();
|
|
253
|
-
const screenWidth = buffer.getInt32();
|
|
254
|
-
const screenHeight = buffer.getInt32();
|
|
255
|
-
let maxQualityIndex = 10;
|
|
256
|
-
// Read the maxQualityIndex if the buffer contains it
|
|
257
|
-
if (buffer.bufferLength - buffer.readOffset >= 4) {
|
|
258
|
-
maxQualityIndex = buffer.getInt32();
|
|
259
|
-
}
|
|
260
|
-
// Read the engine version values if the buffer contains it
|
|
261
|
-
let majorVersion = 0;
|
|
262
|
-
let minorVersion = 0;
|
|
263
|
-
let patchVersion = 0;
|
|
264
|
-
if (buffer.bufferLength - buffer.readOffset >= 12) {
|
|
265
|
-
majorVersion = buffer.getUint32();
|
|
266
|
-
minorVersion = buffer.getUint32();
|
|
267
|
-
patchVersion = buffer.getUint32();
|
|
268
|
-
}
|
|
269
|
-
return new message_1.WebXScreenMessage({ width: screenWidth, height: screenHeight }, maxQualityIndex, new utils_1.WebXVersion(majorVersion, minorVersion, patchVersion), commandId);
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Creates a WebXPingMessage, which is used for pinging purposes.
|
|
274
|
-
*
|
|
275
|
-
* @returns A promise that resolves to a WebXPingMessage.
|
|
276
|
-
*/
|
|
277
|
-
_createPingMessage() {
|
|
278
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
279
|
-
return new message_1.WebXPingMessage();
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Decodes a buffer into a WebXQualityMessage, which contains quality metrics.
|
|
284
|
-
*
|
|
285
|
-
* @param buffer The binary message buffer to decode.
|
|
286
|
-
* @returns A promise that resolves to a WebXQualityMessage.
|
|
287
|
-
*/
|
|
288
|
-
_createQualityMessage(buffer) {
|
|
289
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
290
|
-
const index = buffer.getUint32();
|
|
291
|
-
const imageFPS = buffer.getFloat();
|
|
292
|
-
const rgbQuality = buffer.getFloat();
|
|
293
|
-
const alphaQuality = buffer.getFloat();
|
|
294
|
-
const maxMbps = buffer.getFloat();
|
|
295
|
-
return new message_1.WebXQualityMessage(index, imageFPS, rgbQuality, alphaQuality, maxMbps);
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Decodes a buffer into a WebXClipboardMessage, which contains X11 clipboard content.
|
|
300
|
-
*
|
|
301
|
-
* @param buffer The binary message buffer to decode.
|
|
302
|
-
* @returns A promise that resolves to a WebXClipboardMessage.
|
|
303
|
-
*/
|
|
304
|
-
_createClipboardMessage(buffer) {
|
|
305
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
306
|
-
const clipboardContentSize = buffer.getUint32();
|
|
307
|
-
const clipboardContent = buffer.getString(clipboardContentSize);
|
|
308
|
-
return new message_1.WebXClipboardMessage(clipboardContent);
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Decodes a buffer into a WebXShapeMessage.
|
|
313
|
-
*
|
|
314
|
-
* @param buffer The binary message buffer to decode.
|
|
315
|
-
* @returns A promise that resolves to a WebXShapeMessage.
|
|
316
|
-
*/
|
|
317
|
-
_createShapeMessage(buffer) {
|
|
318
|
-
return new Promise((resolve) => {
|
|
319
|
-
const commandId = buffer.getUint32();
|
|
320
|
-
const windowId = buffer.getUint32();
|
|
321
|
-
const imageType = buffer.getString(4);
|
|
322
|
-
const mimetype = this._determineMimeType(imageType);
|
|
323
|
-
const stencilDataSize = buffer.getUint32();
|
|
324
|
-
const stencilData = buffer.getUint8Array(stencilDataSize);
|
|
325
|
-
this._textureFactory.createTextureFromArray(stencilData, mimetype, three_1.LinearSRGBColorSpace).then(stencilMap => {
|
|
326
|
-
resolve(new message_1.WebXShapeMessage(windowId, stencilMap, commandId, buffer.bufferLength));
|
|
327
|
-
});
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
exports.WebXMessageDecoder = WebXMessageDecoder;
|
|
332
|
-
//# sourceMappingURL=WebXMessageDecoder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebXMessageDecoder.js","sourceRoot":"","sources":["../../../src/transport/WebXMessageDecoder.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAeoB;AACpB,wCAAoF;AAEpF,iCAA2D;AAC3D,oCAAqC;AACrC,8CAAyC;AAEzC;;;;GAIG;AACH,MAAa,kBAAkB;IAC7B;;;;OAIG;IACH,YAAoB,eAAmC;QAAnC,oBAAe,GAAf,eAAe,CAAoB;IAAG,CAAC;IAE3D;;;;;OAKG;IACH,MAAM,CAAC,MAAyB;QAC9B,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;QAEjC,IAAI,aAAa,KAAK,yBAAe,CAAC,GAAG,EAAE,CAAC;YAC1C,OAAO,IAAI,CAAC,iBA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AAC;YACpC,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;YACpD,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;YAC3C,MAAM,WAAW,GAAe,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;YAEtE,IAAI,CAAC,eAAe,CAAC,sBAAsB,CAAC,WAAW,EAAE,QAAQ,EAAE,4BAAoB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;gBACzG,OAAO,CAAC,IAAI,0BAAgB,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAA;YACrF,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CAEF;AA1TD,gDA0TC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
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("./WebXInstructionBuffer"), exports);
|
|
18
|
-
__exportStar(require("./WebXMessageBuffer"), exports);
|
|
19
|
-
__exportStar(require("./WebXMessageDecoder"), exports);
|
|
20
|
-
__exportStar(require("./WebXInstructionEncoder"), exports);
|
|
21
|
-
__exportStar(require("./WebXBinarySerializer"), exports);
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transport/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,sDAAoC;AACpC,uDAAqC;AACrC,2DAAyC;AACzC,yDAAuC"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { WebXInstruction } from '../instruction';
|
|
2
|
-
import { WebXMessage } from '../message';
|
|
3
|
-
import { WebXBinarySerializer } from '../transport';
|
|
4
|
-
/**
|
|
5
|
-
* Represents a communication tunnel between the WebX client and the WebX Engine.
|
|
6
|
-
*
|
|
7
|
-
* This class handles sending and receiving data, managing the connection state,
|
|
8
|
-
* and processing responses from the WebX Engine.
|
|
9
|
-
*/
|
|
10
|
-
export declare abstract class WebXTunnel {
|
|
11
|
-
private static readonly MIN_BUFFER_LENGTH_FOR_ACK;
|
|
12
|
-
protected _serializer: WebXBinarySerializer;
|
|
13
|
-
private _instructionResponses;
|
|
14
|
-
protected constructor();
|
|
15
|
-
/**
|
|
16
|
-
* Establishes a connection to the WebX Engine.
|
|
17
|
-
*
|
|
18
|
-
* @param data The data required to establish the connection.
|
|
19
|
-
* @param serializer The serializer to use for encoding/decoding messages.
|
|
20
|
-
* @returns A promise that resolves when the connection is successfully established.
|
|
21
|
-
*/
|
|
22
|
-
abstract connect(data: any, serializer: WebXBinarySerializer): Promise<Event>;
|
|
23
|
-
/**
|
|
24
|
-
* Closes the connection to the WebX Engine.
|
|
25
|
-
*/
|
|
26
|
-
abstract disconnect(): void;
|
|
27
|
-
/**
|
|
28
|
-
* Sends data to the WebX Engine.
|
|
29
|
-
*
|
|
30
|
-
* @param data The data to send.
|
|
31
|
-
*/
|
|
32
|
-
abstract send(data: ArrayBuffer): void;
|
|
33
|
-
/**
|
|
34
|
-
* Checks if the tunnel is currently connected.
|
|
35
|
-
*
|
|
36
|
-
* @returns True if the tunnel is connected, false otherwise.
|
|
37
|
-
*/
|
|
38
|
-
abstract isConnected(): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Sends an instruction to the WebX Engine.
|
|
41
|
-
*
|
|
42
|
-
* @param command The instruction to send.
|
|
43
|
-
*/
|
|
44
|
-
sendInstruction(command: WebXInstruction): void;
|
|
45
|
-
/**
|
|
46
|
-
* Sends a request to the WebX Engine and waits for a response.
|
|
47
|
-
*
|
|
48
|
-
* @param command The request to send.
|
|
49
|
-
* @param timeout The timeout in milliseconds to wait for a response.
|
|
50
|
-
* @returns A promise that resolves with the response from the WebX Engine.
|
|
51
|
-
*/
|
|
52
|
-
sendRequest(command: WebXInstruction, timeout?: number): Promise<WebXMessage>;
|
|
53
|
-
/**
|
|
54
|
-
* Handles incoming messages from the WebX Engine.
|
|
55
|
-
*
|
|
56
|
-
* @param data The received data.
|
|
57
|
-
*/
|
|
58
|
-
protected onMessage(data: ArrayBuffer): Promise<void>;
|
|
59
|
-
/**
|
|
60
|
-
* Handles a received message from the WebX Engine.
|
|
61
|
-
*
|
|
62
|
-
* @param message The received message.
|
|
63
|
-
*/
|
|
64
|
-
handleMessage(message: WebXMessage): void;
|
|
65
|
-
/**
|
|
66
|
-
* Handles received bytes from the WebX Engine.
|
|
67
|
-
*
|
|
68
|
-
* @param data The received data.
|
|
69
|
-
*/
|
|
70
|
-
handleReceivedBytes(data: ArrayBuffer): void;
|
|
71
|
-
/**
|
|
72
|
-
* Handles sent bytes to the WebX Engine.
|
|
73
|
-
*
|
|
74
|
-
* @param data The sent data.
|
|
75
|
-
*/
|
|
76
|
-
handleSentBytes(data: ArrayBuffer): void;
|
|
77
|
-
/**
|
|
78
|
-
* Handles the close event of the connection.
|
|
79
|
-
*
|
|
80
|
-
* @param event The close event.
|
|
81
|
-
*/
|
|
82
|
-
handleClose(event: CloseEvent): void;
|
|
83
|
-
/**
|
|
84
|
-
* Called when the connection is closed.
|
|
85
|
-
*/
|
|
86
|
-
onClosed(): void;
|
|
87
|
-
/**
|
|
88
|
-
* Handles critical messages such as PING and data acknowledgments.
|
|
89
|
-
*
|
|
90
|
-
* @param buffer The message buffer.
|
|
91
|
-
*/
|
|
92
|
-
private _handleCriticalMessages;
|
|
93
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
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 message_1 = require("../message");
|
|
15
|
-
const transport_1 = require("../transport");
|
|
16
|
-
/**
|
|
17
|
-
* Represents a communication tunnel between the WebX client and the WebX Engine.
|
|
18
|
-
*
|
|
19
|
-
* This class handles sending and receiving data, managing the connection state,
|
|
20
|
-
* and processing responses from the WebX Engine.
|
|
21
|
-
*/
|
|
22
|
-
class WebXTunnel {
|
|
23
|
-
constructor() {
|
|
24
|
-
this._instructionResponses = new Map();
|
|
25
|
-
this._serializer = null;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Sends an instruction to the WebX Engine.
|
|
29
|
-
*
|
|
30
|
-
* @param command The instruction to send.
|
|
31
|
-
*/
|
|
32
|
-
sendInstruction(command) {
|
|
33
|
-
// console.log(`Sending command: `, command);
|
|
34
|
-
const message = this._serializer.serializeInstruction(command);
|
|
35
|
-
this.send(message);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Sends a request to the WebX Engine and waits for a response.
|
|
39
|
-
*
|
|
40
|
-
* @param command The request to send.
|
|
41
|
-
* @param timeout The timeout in milliseconds to wait for a response.
|
|
42
|
-
* @returns A promise that resolves with the response from the WebX Engine.
|
|
43
|
-
*/
|
|
44
|
-
sendRequest(command, timeout) {
|
|
45
|
-
// console.log(`Sending request: `, command);
|
|
46
|
-
command.synchronous = true;
|
|
47
|
-
timeout = timeout || 10000;
|
|
48
|
-
const response = new instruction_1.WebXInstructionResponse(command, timeout);
|
|
49
|
-
this._instructionResponses.set(command.id, response);
|
|
50
|
-
return new Promise((resolve, reject) => {
|
|
51
|
-
const message = this._serializer.serializeInstruction(command);
|
|
52
|
-
this.send(message);
|
|
53
|
-
response
|
|
54
|
-
.then(resolve)
|
|
55
|
-
.catch((error) => {
|
|
56
|
-
this._instructionResponses.delete(command.id);
|
|
57
|
-
reject(error);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Handles incoming messages from the WebX Engine.
|
|
63
|
-
*
|
|
64
|
-
* @param data The received data.
|
|
65
|
-
*/
|
|
66
|
-
onMessage(data) {
|
|
67
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
if (data.byteLength === 0) {
|
|
69
|
-
console.warn('Got a zero length message');
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
else if (data.byteLength < transport_1.WebXMessageBuffer.MESSAGE_HEADER_LENGTH) {
|
|
73
|
-
console.warn('Message does not contain a valid header');
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
const buffer = new transport_1.WebXMessageBuffer(data);
|
|
77
|
-
this._handleCriticalMessages(buffer);
|
|
78
|
-
this.handleReceivedBytes(data);
|
|
79
|
-
const message = yield this._serializer.deserializeMessage(buffer);
|
|
80
|
-
if (message != null) {
|
|
81
|
-
// Handle any blocking requests
|
|
82
|
-
if (message.commandId != null && this._instructionResponses.get(message.commandId) != null) {
|
|
83
|
-
const instructionResponse = this._instructionResponses.get(message.commandId);
|
|
84
|
-
this._instructionResponses.delete(message.commandId);
|
|
85
|
-
instructionResponse.resolve(message);
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
// Send async message
|
|
89
|
-
this.handleMessage(message);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Handles a received message from the WebX Engine.
|
|
96
|
-
*
|
|
97
|
-
* @param message The received message.
|
|
98
|
-
*/
|
|
99
|
-
handleMessage(message) {
|
|
100
|
-
throw new Error('Method not implemented.');
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Handles received bytes from the WebX Engine.
|
|
104
|
-
*
|
|
105
|
-
* @param data The received data.
|
|
106
|
-
*/
|
|
107
|
-
handleReceivedBytes(data) {
|
|
108
|
-
throw new Error('Method not implemented.');
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Handles sent bytes to the WebX Engine.
|
|
112
|
-
*
|
|
113
|
-
* @param data The sent data.
|
|
114
|
-
*/
|
|
115
|
-
handleSentBytes(data) {
|
|
116
|
-
throw new Error('Method not implemented');
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Handles the close event of the connection.
|
|
120
|
-
*
|
|
121
|
-
* @param event The close event.
|
|
122
|
-
*/
|
|
123
|
-
handleClose(event) {
|
|
124
|
-
// Clear all pending instruction responses
|
|
125
|
-
this._instructionResponses.forEach((response) => {
|
|
126
|
-
response.reject('Tunnel closed');
|
|
127
|
-
});
|
|
128
|
-
this.onClosed();
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Called when the connection is closed.
|
|
132
|
-
*/
|
|
133
|
-
onClosed() {
|
|
134
|
-
console.log(`Websocket closed`);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Handles critical messages such as PING and data acknowledgments.
|
|
138
|
-
*
|
|
139
|
-
* @param buffer The message buffer.
|
|
140
|
-
*/
|
|
141
|
-
_handleCriticalMessages(buffer) {
|
|
142
|
-
if (buffer.messageTypeId == message_1.WebXMessageType.PING) {
|
|
143
|
-
// Reply immediately with a pong
|
|
144
|
-
this.sendInstruction(new instruction_1.WebXPongInstruction(buffer.timestampMs));
|
|
145
|
-
}
|
|
146
|
-
else if (buffer.messageTypeId == message_1.WebXMessageType.SUBIMAGES || buffer.messageTypeId == message_1.WebXMessageType.IMAGE) {
|
|
147
|
-
// Reply immediately with a data ack (if size greater than cutoff)
|
|
148
|
-
if (buffer.bufferLength > WebXTunnel.MIN_BUFFER_LENGTH_FOR_ACK) {
|
|
149
|
-
this.sendInstruction(new instruction_1.WebXDataAckInstruction(buffer.timestampMs, buffer.bufferLength));
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
exports.WebXTunnel = WebXTunnel;
|
|
155
|
-
WebXTunnel.MIN_BUFFER_LENGTH_FOR_ACK = 32768;
|
|
156
|
-
//# sourceMappingURL=WebXTunnel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebXTunnel.js","sourceRoot":"","sources":["../../../src/tunnel/WebXTunnel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAAqH;AACrH,wCAAwD;AACxD,4CAAuE;AAEvE;;;;;GAKG;AACH,MAAsB,UAAU;IAO9B;QAFQ,0BAAqB,GAA8C,IAAI,GAAG,EAAwC,CAAC;QAGzH,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IA8BD;;;;OAIG;IACH,eAAe,CAAC,OAAwB;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