From f64f21f33abebb35387eb8be8388a56fc31a783b Mon Sep 17 00:00:00 2001 From: Matthew Cotton Date: Thu, 1 Feb 2024 09:17:29 +1100 Subject: [PATCH 1/7] Small cleanup with common ts build --- Common/package-lock.json | 4 ++-- Common/package.json | 4 ++-- Common/tsconfig.base.json | 11 +++++++++++ Common/tsconfig.cjs.json | 9 +++++++++ Common/tsconfig.esm.json | 7 +++++++ Common/tsconfig.json | 25 ------------------------- 6 files changed, 31 insertions(+), 29 deletions(-) create mode 100644 Common/tsconfig.base.json create mode 100644 Common/tsconfig.cjs.json create mode 100644 Common/tsconfig.esm.json delete mode 100644 Common/tsconfig.json diff --git a/Common/package-lock.json b/Common/package-lock.json index 817764fe..38e72052 100644 --- a/Common/package-lock.json +++ b/Common/package-lock.json @@ -1,12 +1,12 @@ { "name": "@epicgames-ps/lib-pixelstreamingcommon-ue5.5", - "version": "0.0.6", + "version": "0.0.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@epicgames-ps/lib-pixelstreamingcommon-ue5.5", - "version": "0.0.6", + "version": "0.0.8", "license": "MIT", "dependencies": { "@protobuf-ts/plugin": "^2.9.3" diff --git a/Common/package.json b/Common/package.json index 5fb7ed2c..01af5488 100644 --- a/Common/package.json +++ b/Common/package.json @@ -3,12 +3,12 @@ "version": "0.0.8", "description": "Common utilities library for Unreal Engine 5.5 Pixel Streaming", "main": "build/commonjs/pixelstreamingcommon.js", - "module": "build/es2015/pixelstreamingcommon.js", + "module": "build/esm/pixelstreamingcommon.js", "types": "build/types/pixelstreamingcommon.d.ts", "sideEffects": false, "scripts": { "build_proto": "npx protoc --ts_out src/Messages --proto_path protobuf protobuf/signalling_messages.proto", - "compile": "rimraf ./build && tsc --module es2015 --outDir build/es2015 && tsc --module commonjs --outDir build/commonjs --declaration --declarationDir build/types", + "compile": "rimraf ./build && tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json", "build": "npm run build_proto && npm run compile", "test": "echo \"Error: no test specified\" && exit 1", "lint": "eslint . --ext .js,.jsx,.ts,.tsx" diff --git a/Common/tsconfig.base.json b/Common/tsconfig.base.json new file mode 100644 index 00000000..be58135d --- /dev/null +++ b/Common/tsconfig.base.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "noImplicitAny": true, + "esModuleInterop": true, + "target": "ES6", + "moduleResolution": "node", + "sourceMap": true, + "allowJs": true + }, + "include": ["./src/*.ts"], +} diff --git a/Common/tsconfig.cjs.json b/Common/tsconfig.cjs.json new file mode 100644 index 00000000..ccee4d61 --- /dev/null +++ b/Common/tsconfig.cjs.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "outDir": "./build/commonjs", + "module": "commonjs", + "declaration": true, + "declarationDir": "./build/types" + } +} diff --git a/Common/tsconfig.esm.json b/Common/tsconfig.esm.json new file mode 100644 index 00000000..184e0dcd --- /dev/null +++ b/Common/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "outDir": "./build/esm", + "module": "es2015" + } +} diff --git a/Common/tsconfig.json b/Common/tsconfig.json deleted file mode 100644 index 2384467b..00000000 --- a/Common/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "outDir": "./types", - "noImplicitAny": true, - "module": "es6", - "esModuleInterop": true, - "target": "ES6", - "moduleResolution": "node", - "sourceMap": true, - "allowJs": true, - "declaration": true - }, - "lib": ["es2015"], - "include": ["./src/*.ts"], - "exclude": ["./src/**/*.test.ts"], - "typedocOptions": { - "exclude": "src/index.*", - "entryPoints": ["src/pixelstreamingcommon.ts"], - "sort": ["enum-value-ascending", "required-first", "source-order"], - "out": "docs", - "theme": "default", - "hideGenerator": "true" - } -} - From 67ad874a9a525915006911ec7925db328d5d92bb Mon Sep 17 00:00:00 2001 From: Matthew Cotton Date: Thu, 1 Feb 2024 09:37:04 +1100 Subject: [PATCH 2/7] Adding some useful comments in SignallingProtocol. SignallingProtocol has nothing to do with web sockets so renamed its folder to Protocol --- .../SignallingProtocol.ts | 21 ++++++++++++++++++- Common/src/pixelstreamingcommon.ts | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) rename Common/src/{WebSockets => Protocol}/SignallingProtocol.ts (82%) diff --git a/Common/src/WebSockets/SignallingProtocol.ts b/Common/src/Protocol/SignallingProtocol.ts similarity index 82% rename from Common/src/WebSockets/SignallingProtocol.ts rename to Common/src/Protocol/SignallingProtocol.ts index cade880e..4f526dd4 100644 --- a/Common/src/WebSockets/SignallingProtocol.ts +++ b/Common/src/Protocol/SignallingProtocol.ts @@ -14,12 +14,31 @@ export class SignallingProtocol { private transport: ITransport; /** - * Listen on this emitter for transport events, open, close, error. + * Listen on this emitter for transport events. + * + * Events emitted: + * open: + * Emitted when the transport connection opens and is ready to handle messages. + * + * error: + * Emitted when there is an error on the transport has an error and must close. + * + * close: + * Emitted when the transport connection closes and can no longer send or + * receive messages. Will also be emitted after an error. + * + * message: + * Emitted any time a message is received by the transport. Listen on this if + * you wish to capture all messages, rather than specific messages on + * 'messageHandlers'. */ transportEvents: EventEmitter; /** * Listen on this emitter for messages. Message type is the name of the event to listen for. + * + * Example: + * messageHandlers.addListener('config', (message: Messages.config) => console.log(`Got a config message: ${message}`))); */ messageHandlers: EventEmitter; diff --git a/Common/src/pixelstreamingcommon.ts b/Common/src/pixelstreamingcommon.ts index 1dbe090c..4d096e3e 100644 --- a/Common/src/pixelstreamingcommon.ts +++ b/Common/src/pixelstreamingcommon.ts @@ -1,7 +1,7 @@ export { Logger } from './Logger/Logger'; export { ITransport } from './Transport/ITransport'; export { WebSocketTransport } from './Transport/WebSocketTransport'; -export { SignallingProtocol } from './WebSockets/SignallingProtocol'; +export { SignallingProtocol } from './Protocol/SignallingProtocol'; export { IMessageType } from "@protobuf-ts/runtime"; export { BaseMessage } from './Messages/base_message'; export { MessageRegistry } from './Messages/message_registry'; From 012d3ac6c312d5307e48b734e8a977a67436ad2a Mon Sep 17 00:00:00 2001 From: Matthew Cotton Date: Thu, 1 Feb 2024 09:52:11 +1100 Subject: [PATCH 3/7] Adding a nodejs version of websockets transport --- Common/package-lock.json | 76 +++++++++++---- Common/package.json | 4 +- Common/src/Transport/WebSocketTransportNJS.ts | 97 +++++++++++++++++++ Common/src/pixelstreamingcommon.ts | 1 + 4 files changed, 160 insertions(+), 18 deletions(-) create mode 100644 Common/src/Transport/WebSocketTransportNJS.ts diff --git a/Common/package-lock.json b/Common/package-lock.json index 38e72052..43cc2413 100644 --- a/Common/package-lock.json +++ b/Common/package-lock.json @@ -9,7 +9,9 @@ "version": "0.0.8", "license": "MIT", "dependencies": { - "@protobuf-ts/plugin": "^2.9.3" + "@protobuf-ts/plugin": "^2.9.3", + "@types/ws": "^8.5.10", + "ws": "^8.16.0" }, "devDependencies": { "@types/jest": "27.5.1", @@ -1751,7 +1753,6 @@ "version": "20.10.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.3.tgz", "integrity": "sha512-XJavIpZqiXID5Yxnxv3RUDKTN5b81ddNC3ecsA0SoFXz/QU8OGBwZGMomiq0zw+uuqbL/krztv/DINAQ/EV4gg==", - "dev": true, "dependencies": { "undici-types": "~5.26.4" } @@ -1780,6 +1781,14 @@ "integrity": "sha512-n3u5sqXQJhf1CS68mw3Wf16FQ4cRPNBBwdYLFzq3UddiADOim1Pn3Y6PBdDilz1vOJF3ybLxJ8ZEDlLIzrOQZg==", "dev": true }, + "node_modules/@types/ws": { + "version": "8.5.10", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz", + "integrity": "sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/yargs": { "version": "16.0.9", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.9.tgz", @@ -4921,6 +4930,27 @@ } } }, + "node_modules/jsdom/node_modules/ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "dev": true, + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -6571,8 +6601,7 @@ "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, "node_modules/unique-string": { "version": "2.0.0", @@ -6907,16 +6936,15 @@ } }, "node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", - "dev": true, + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", "engines": { - "node": ">=8.3.0" + "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" + "utf-8-validate": ">=5.0.2" }, "peerDependenciesMeta": { "bufferutil": { @@ -8396,7 +8424,6 @@ "version": "20.10.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.3.tgz", "integrity": "sha512-XJavIpZqiXID5Yxnxv3RUDKTN5b81ddNC3ecsA0SoFXz/QU8OGBwZGMomiq0zw+uuqbL/krztv/DINAQ/EV4gg==", - "dev": true, "requires": { "undici-types": "~5.26.4" } @@ -8425,6 +8452,14 @@ "integrity": "sha512-n3u5sqXQJhf1CS68mw3Wf16FQ4cRPNBBwdYLFzq3UddiADOim1Pn3Y6PBdDilz1vOJF3ybLxJ8ZEDlLIzrOQZg==", "dev": true }, + "@types/ws": { + "version": "8.5.10", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz", + "integrity": "sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==", + "requires": { + "@types/node": "*" + } + }, "@types/yargs": { "version": "16.0.9", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.9.tgz", @@ -10801,6 +10836,15 @@ "whatwg-url": "^8.5.0", "ws": "^7.4.6", "xml-name-validator": "^3.0.0" + }, + "dependencies": { + "ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "dev": true, + "requires": {} + } } }, "jsesc": { @@ -11990,8 +12034,7 @@ "undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, "unique-string": { "version": "2.0.0", @@ -12245,10 +12288,9 @@ } }, "ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", - "dev": true, + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", "requires": {} }, "xdg-basedir": { diff --git a/Common/package.json b/Common/package.json index 01af5488..a2954dca 100644 --- a/Common/package.json +++ b/Common/package.json @@ -35,6 +35,8 @@ "access": "public" }, "dependencies": { - "@protobuf-ts/plugin": "^2.9.3" + "@protobuf-ts/plugin": "^2.9.3", + "@types/ws": "^8.5.10", + "ws": "^8.16.0" } } diff --git a/Common/src/Transport/WebSocketTransportNJS.ts b/Common/src/Transport/WebSocketTransportNJS.ts new file mode 100644 index 00000000..8fa6fb4b --- /dev/null +++ b/Common/src/Transport/WebSocketTransportNJS.ts @@ -0,0 +1,97 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +import { ITransport } from './ITransport'; +import { BaseMessage } from '../Messages/base_message'; +import WebSocket from 'ws'; +import { EventEmitter } from 'events'; + +/** + * An implementation of WebSocketTransport from pixelstreamingcommon that supports node.js websockets + * This is needed because of the slight differences between the 'ws' node.js package and the websockets + * supported in the browsers. + * If you are using this code in a browser use 'WebSocketTransport' instead. + */ +export class WebSocketTransportNJS implements ITransport { + WS_OPEN_STATE = 1; + webSocket: WebSocket; + events: EventEmitter; + + constructor() { + this.events = new EventEmitter(); + } + + sendMessage(msg: BaseMessage): void { + this.webSocket.send(JSON.stringify(msg)); + } + + onMessage: (msg: BaseMessage) => void; + + /** + * Connect to the signaling server + * @param connectionURL - The Address of the signaling server + * @returns - If there is a connection + */ + connect(connectionURL: string): boolean { + this.webSocket = new WebSocket(connectionURL); + this.webSocket.addEventListener("open", event => this.handleOnOpen(event)); + this.webSocket.addEventListener("error", event => this.handleOnError(event)); + this.webSocket.addEventListener("close", event => this.handleOnClose(event)); + this.webSocket.addEventListener("message", event => this.handleOnMessage(event)); + return true; + } + + disconnect(): void { + this.webSocket.close(); + } + + isConnected(): boolean { + return this.webSocket && this.webSocket.readyState != WebSocket.CLOSED + } + + /** + * Handles what happens when a message is received + * @param event - Message Received + */ + handleOnMessage(event: WebSocket.MessageEvent) { + let parsedMessage; + try { + parsedMessage = JSON.parse(event.data as string); + } catch (e) { + return; + } + + this.onMessage(parsedMessage); + } + + /** + * Handles when the Websocket is opened + * @param event - Not Used + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + handleOnOpen(event: WebSocket.Event) { + this.events.emit('open', event); + } + + /** + * Handles when there is an error on the websocket + * @param event - Error Payload + */ + handleOnError(event: WebSocket.ErrorEvent) { + this.events.emit('error', event); + } + + /** + * Handles when the Websocket is closed + * @param event - Close Event + */ + handleOnClose(event: WebSocket.CloseEvent) { + this.events.emit('close', event); + } + + /** + * Closes the Websocket connection + */ + close() { + this.webSocket?.close(); + } +} diff --git a/Common/src/pixelstreamingcommon.ts b/Common/src/pixelstreamingcommon.ts index 4d096e3e..dcfda7df 100644 --- a/Common/src/pixelstreamingcommon.ts +++ b/Common/src/pixelstreamingcommon.ts @@ -1,6 +1,7 @@ export { Logger } from './Logger/Logger'; export { ITransport } from './Transport/ITransport'; export { WebSocketTransport } from './Transport/WebSocketTransport'; +export { WebSocketTransportNJS } from './Transport/WebSocketTransportNJS'; export { SignallingProtocol } from './Protocol/SignallingProtocol'; export { IMessageType } from "@protobuf-ts/runtime"; export { BaseMessage } from './Messages/base_message'; From 04fc45b23bb212c2b5a1a7223243f3d1aeb3af36 Mon Sep 17 00:00:00 2001 From: Matthew Cotton Date: Thu, 1 Feb 2024 09:52:42 +1100 Subject: [PATCH 4/7] Fixing a small issue with sending offer/answer messages --- Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts b/Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts index 845318f8..c41bf824 100644 --- a/Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts +++ b/Frontend/library/src/WebRtcPlayer/WebRtcPlayerController.ts @@ -1610,7 +1610,7 @@ export class WebRtcPlayerController { maxBitrateBps: 1000 * this.config.getNumericSettingValue(NumericParameters.WebRTCMaxBitrate) }; - this.protocol.sendWebRtcOffer(MessageHelpers.createMessage(Messages.offer, extraParams)); + this.protocol.sendWebRtcOffer(extraParams); } /** @@ -1630,7 +1630,7 @@ export class WebRtcPlayerController { maxBitrateBps: 1000 * this.config.getNumericSettingValue(NumericParameters.WebRTCMaxBitrate) }; - this.protocol.sendWebRtcOffer(MessageHelpers.createMessage(Messages.answer, extraParams)); + this.protocol.sendWebRtcAnswer(extraParams); if (this.isUsingSFU) { this.protocol.sendWebRtcDatachannelRequest(); From cc68097cbad133d7cf023c74a67aeb9bdf21ccd8 Mon Sep 17 00:00:00 2001 From: Matthew Cotton Date: Thu, 1 Feb 2024 09:53:36 +1100 Subject: [PATCH 5/7] Moved the websocket transport implementation to common. now using WebSocketsTransportNJS from common --- SS_Test/src/WebSocketTransportCJS.ts | 93 ---------------------------- SS_Test/src/signalling_tester.ts | 4 +- 2 files changed, 2 insertions(+), 95 deletions(-) delete mode 100644 SS_Test/src/WebSocketTransportCJS.ts diff --git a/SS_Test/src/WebSocketTransportCJS.ts b/SS_Test/src/WebSocketTransportCJS.ts deleted file mode 100644 index 4ee5348f..00000000 --- a/SS_Test/src/WebSocketTransportCJS.ts +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright Epic Games, Inc. All Rights Reserved. - -import { ITransport, BaseMessage } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5'; -import WebSocket from 'ws'; -import { EventEmitter } from 'events'; - -/** - * An implementation of WebSocketTransport from pixelstreamingcommon that supports commonjs websockets - */ -export class WebSocketTransportCJS implements ITransport { - WS_OPEN_STATE = 1; - webSocket: WebSocket; - events: EventEmitter; - - constructor() { - this.events = new EventEmitter(); - } - - sendMessage(msg: BaseMessage): void { - this.webSocket.send(JSON.stringify(msg)); - } - - onMessage: (msg: BaseMessage) => void; - - /** - * Connect to the signaling server - * @param connectionURL - The Address of the signaling server - * @returns - If there is a connection - */ - connect(connectionURL: string): boolean { - this.webSocket = new WebSocket(connectionURL); - this.webSocket.addEventListener("open", event => this.handleOnOpen(event)); - this.webSocket.addEventListener("error", event => this.handleOnError(event)); - this.webSocket.addEventListener("close", event => this.handleOnClose(event)); - this.webSocket.addEventListener("message", event => this.handleOnMessage(event)); - return true; - } - - disconnect(): void { - this.webSocket.close(); - } - - isConnected(): boolean { - return this.webSocket && this.webSocket.readyState != WebSocket.CLOSED - } - - /** - * Handles what happens when a message is received - * @param event - Message Received - */ - handleOnMessage(event: WebSocket.MessageEvent) { - let parsedMessage; - try { - parsedMessage = JSON.parse(event.data as string); - } catch (e) { - return; - } - - this.onMessage(parsedMessage); - } - - /** - * Handles when the Websocket is opened - * @param event - Not Used - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - handleOnOpen(event: WebSocket.Event) { - this.events.emit('open', event); - } - - /** - * Handles when there is an error on the websocket - * @param event - Error Payload - */ - handleOnError(event: WebSocket.ErrorEvent) { - this.events.emit('error', event); - } - - /** - * Handles when the Websocket is closed - * @param event - Close Event - */ - handleOnClose(event: WebSocket.CloseEvent) { - this.events.emit('close', event); - } - - /** - * Closes the Websocket connection - */ - close() { - this.webSocket?.close(); - } -} diff --git a/SS_Test/src/signalling_tester.ts b/SS_Test/src/signalling_tester.ts index 19ed927f..b09ee862 100644 --- a/SS_Test/src/signalling_tester.ts +++ b/SS_Test/src/signalling_tester.ts @@ -2,8 +2,8 @@ import { IMessageType, BaseMessage, MessageRegistry, MessageHelpers, + WebSocketTransportNJS, SignallingProtocol } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5'; -import { WebSocketTransportCJS } from './WebSocketTransportCJS'; import WebSocket from 'ws'; export interface ExpectedMessage { @@ -157,7 +157,7 @@ export class SignallingConnection { this.failedCallback = (connection, unsatisfiedExpects, unhandledEvents) => {}; this.processTimer = null; - this.protocol = new SignallingProtocol(new WebSocketTransportCJS()); + this.protocol = new SignallingProtocol(new WebSocketTransportNJS()); this.protocol.transportEvents.addListener("open", event => this.onConnectionOpen(event)); this.protocol.transportEvents.addListener("error", event => this.onConnectionError(event)); this.protocol.transportEvents.addListener("close", event => this.onConnectionClose(event)); From 2e9f7951f6dd6ff1a6e450f3464d6871bcdd6f12 Mon Sep 17 00:00:00 2001 From: Matthew Cotton Date: Thu, 1 Feb 2024 10:19:23 +1100 Subject: [PATCH 6/7] Updating docker tests to use unpublished library code. --- SS_Test/Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SS_Test/Dockerfile b/SS_Test/Dockerfile index b48ef73e..3fcfeca7 100644 --- a/SS_Test/Dockerfile +++ b/SS_Test/Dockerfile @@ -1,14 +1,14 @@ FROM node:18.17.0 as builder -COPY SS_Test/package*.json /SignallingTester/SS_Test/ -COPY Common/protobuf/signalling_messages.proto /SignallingTester/Common/protobuf/signalling_messages.proto +WORKDIR /SignallingTester + +COPY Common/ . +COPY SS_Test/ . WORKDIR /SignallingTester/SS_Test RUN npm ci - -COPY SS_Test/. . - +RUN npm link ../Common RUN npm run build USER node From 055c71f29d52424ad0bca4ed8338612f9771fc96 Mon Sep 17 00:00:00 2001 From: Matthew Cotton Date: Thu, 1 Feb 2024 10:32:35 +1100 Subject: [PATCH 7/7] Actually fixing dockerfile --- SS_Test/Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/SS_Test/Dockerfile b/SS_Test/Dockerfile index 3fcfeca7..78fdae2b 100644 --- a/SS_Test/Dockerfile +++ b/SS_Test/Dockerfile @@ -2,8 +2,13 @@ FROM node:18.17.0 as builder WORKDIR /SignallingTester -COPY Common/ . -COPY SS_Test/ . +COPY Common/ Common +COPY SS_Test/ SS_Test + +WORKDIR /SignallingTester/Common + +RUN npm ci +RUN npm run build WORKDIR /SignallingTester/SS_Test