Skip to content

JS Mqtt - PR #6 Protocol implementation#702

Open
bretambrose wants to merge 16 commits intoJsMqtt-5-Validationfrom
JsMqtt-6-Protocol
Open

JS Mqtt - PR #6 Protocol implementation#702
bretambrose wants to merge 16 commits intoJsMqtt-5-Validationfrom
JsMqtt-6-Protocol

Conversation

@bretambrose
Copy link
Copy Markdown
Contributor

Implementation of the client-side protocol requirements for MQTT 311 and 5

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@bretambrose bretambrose marked this pull request as ready for review March 23, 2026 16:08
Comment thread lib/browser/mqtt_internal/protocol.ts
Copy link
Copy Markdown
Contributor

@sbSteveK sbSteveK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly trivial but one area of concern in regard to rejoining a session operation order.

Comment thread lib/browser/mqtt_internal/protocol.ts
Comment thread lib/browser/mqtt_internal/protocol.ts Outdated
Comment thread lib/browser/mqtt_internal/protocol.ts Outdated
Comment thread lib/browser/mqtt_internal/protocol.ts Outdated
Comment thread lib/browser/mqtt_internal/protocol.ts Outdated

// user operations require more logic since there are certain conditions that we cannot
// dequeue them (receive maximum limit, no packet ids, etc...)
let id = this.userOperationQueue.shift();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trivial: Instead of shift() unshift() maybe we should use let id = this.userOperationQueue[0]
https://stackoverflow.com/questions/42501871/peek-operation-in-stack-using-javascript
This should return undefined if nothing is there and we can check against this.canDequeueUserOperation without the need to unshift it back in place.

Copy link
Copy Markdown
Contributor Author

@bretambrose bretambrose Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not comfortable using an array as a filterable dequeue (example is a strict stack) using indexing operations.

Comment thread lib/browser/mqtt_internal/protocol.ts Outdated
while (!done) {
let currentOperation : ClientOperation | undefined = undefined;
if (this.currentOperation != undefined) {
currentOperation = this.operations.get(this.currentOperation);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little confusing that this.currentOperation is the operations id ,while currentOperation is the operation object. Maybe rename it to this.currentOperationId?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants