node
node copied to clipboard
Sockets joining two messages.
Version
18.20.2
Platform
Linux # 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
You need to use socket, in a way, that you create middle man server, handling more socket connections. Then when you send message trough middleman, and message from middleman, it ends up with joining two different net.server.write's to one statement that is received by target application.
Middle man is passing message "connectionEstablished" to both ends of socket pipe, then I recieve
{"context":"connectionEstablished"}{"context":"test","data":"whatever"}
In the application, because it joined data with what application sends, it's two totally different writes called.
How often does it reproduce? Is there a required condition?
Every time a send a socket message trough middle man.
What is the expected behavior? Why is that the expected behavior?
I expect it to be two different messages per two different socket.write calls.
What do you see instead?
{"context":"connectionEstablished"}{"context":"test","data":"whatever"}
I expect it to be two different messages.
Additional information
Am I missing something? If described behaviour is expected, how to differentiate between specific message at end point? Like I need to rewrite JSON.parse because of that, which seems to be utterly wrong.