-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update websocket implementation over MQTT to not send multiple ws frames for a single MQTT packet #1873
Conversation
ff5a2df
to
05deb60
Compare
// - The property ReferenceCount of a byte buffer implementation maintains a counter of the no of messages available for dequeueing. | ||
// A ReferenceCount of 0 indicates that all messages have been flushed and the buffer can be deallocated. | ||
// By calling the method Retain() on each byte buffer component added to the CompositeByteBuffer, | ||
// we increase the ReferenceCount by 1 and mark them as ready for dequeuing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the spelling of dequeuing here is different than the one on line 291. Not sure which one is right :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops, "dequeuing" (so many extra alphabets just sitting there needlessly)
a1bd21e
to
dfa67d7
Compare
… to not send multiple ws frames for a single MQTT packet
dfa67d7
to
33503fc
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
This PR updates our websocket implementation over MQTT to send a single ws frame per MQTT packet being sent.
In short - our websocket implementation sent each message dequeued from the ChannelOutboundBuffer individually, which sometimes resulted in multiple messages being sent for a single MQTT packet (eg. PUBLISH packet encodes the topic and payload separately, so they would show up as different tcp packets on the wire). The fix is to dequeue all enqueued messages and consolidate them before writing to websocket.
I have added the comments in the code explaining the fix, let me know if something is unclear and I can update it.
Fix for #1814
This github issue also contains some details: Azure/DotNetty#553