Update live connection handshake structure #70

Merged
luca0N merged 2 commits from dev_client_live_handshake into dev 2026-05-07 23:58:37 +00:00
Owner

Introduce required live connection flow changes imposed by the changes
made to the server code in commits
e6353ca48a and
b7f7f1dbf0, and refactor the serial packet
request flow by keeping track of the current operation with an enum
named `LiveStage'.

Introduce required live connection flow changes imposed by the changes made to the server code in commits e6353ca48a94be7dff652ca7b8002b19b07d773c and b7f7f1dbf0940ccfbf00a310f1425052b28c515e, and refactor the serial packet request flow by keeping track of the current operation with an enum named `LiveStage'.
Introduce required live connection flow changes imposed by the changes
made to the server code in commits
e6353ca48a and
b7f7f1dbf0, and refactor the serial packet
request flow by keeping track of the current operation with an enum
named `LiveStage'.
luca0N force-pushed dev_client_live_handshake from 5cb6da924c to ee97e0de5c 2026-05-07 23:11:40 +00:00 Compare
Author
Owner

Latest force-push removes an unused import and class variable.

Latest force-push removes an unused import and class variable.
luca0N force-pushed dev_client_live_handshake from ee97e0de5c to 2a39e1f14c 2026-05-07 23:12:37 +00:00 Compare
luca0N left a comment

Some minor things to enhance the code quality before merging this pull request.

Some minor things to enhance the code quality before merging this pull request.
@ -55,3 +61,2 @@
version: string;
action: string;
data: string | undefined;
data: any;
Author
Owner

I would like for data to actually refer to a generic type T for higher flexibility. Although any is as permissive as it gets, we'd lack standard TypeScript safeguards.

I would like for `data` to actually refer to a generic type `T` for higher flexibility. Although `any` is as permissive as it gets, we'd lack standard TypeScript safeguards.
Author
Owner

This will be done outside this pull request.

This will be done outside this pull request.
@ -93,18 +97,27 @@ interface LiveConnectionData {
port: number;
}
enum LiveStage {
Author
Owner

Some inline documentation would do some good here.

Some inline documentation would do some good here.
luca0N marked this conversation as resolved
@ -142,0 +162,4 @@
let packetData = undefined;
switch (this.liveStage) {
case LiveStage.LIVE_STAGE_CLIENT_ACTION_HELLO:
packetAction = "HELLO";
Author
Owner

These strings should likely be in the form of consts, or as part of an enum which can be converted to strings as necessary. Having these values hardcoded throughout the code is prone to errors.

These strings should likely be in the form of `const`s, or as part of an enum which can be converted to strings as necessary. Having these values hardcoded throughout the code is prone to errors.
luca0N marked this conversation as resolved
@ -142,0 +180,4 @@
if (packetData !== undefined)
packet.data = packetData;
this.ws?.send(JSON.stringify(packet));
Author
Owner

An Error should be thrown if this.ws is null.

An `Error` should be thrown if `this.ws` is null.
luca0N marked this conversation as resolved
Add missing documentation to the changes made to LiveConnection, and
perform minor code refactoring by moving hardcoded strings to a new
enum.

See previous commit for context on the changes made to LiveConnection.
luca0N deleted branch dev_client_live_handshake 2026-05-07 23:58:37 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
luca0N/lanbassador!70
No description provided.