max-mapper / websocket-stream

websockets with the node stream API
BSD 2-Clause "Simplified" License
668 stars 114 forks source link

Loses objectMode part of logic. Don't work cork/uncork #146

Open scarry1992 opened 5 years ago

scarry1992 commented 5 years ago

When I create a stream with option objectMode: false, I lose cork/uncork part of logic. That's happens in duplexify in https://github.com/maxogden/websocket-stream/blob/master/stream.js#L76. When I remove that initial stream by duplexify and leave stream = proxy only, everything works well. Can you tell me why you are doing stream by duplexify and what benefits it gives. And maybe I can help resolve this issue?

mcollina commented 5 years ago

This should be fixed, right?

scarry1992 commented 5 years ago

@mcollina, do you read last comment in pr in websocket-stream? With cork logic first writing packet in stream separated for two socket frames. I would like your help for resolve it. I attached screenshots with callstacks of two writing operations.

mcollina commented 5 years ago

Sorry I didn’t understood the problem or your comment. Can you rephrase it please, and maybe post a PR with a failing test?

scarry1992 commented 5 years ago

Sorry, test was been written and he is passed. But testing pr with mqtt.js shows - every packet was been separated for two chunks. And I attached two screenshots for getting your help;)

mcollina commented 5 years ago

I have no clue given those screenshots. I’ll need an example that say “yes/no” to check things out. This way to complex to debug for the time I have available.:

scarry1992 commented 5 years ago

Ok then, I will attach example at Monday, ok?

mcollina commented 5 years ago

sure!

Il giorno sab 6 apr 2019 alle 13:55 scarry1992 notifications@github.com ha scritto:

Ok then, I will attach example at Monday, ok?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/maxogden/websocket-stream/issues/146#issuecomment-480498160, or mute the thread https://github.com/notifications/unsubscribe-auth/AADL4-d3P_d0hivoli9dnV1RJODLWjiPks5veIsYgaJpZM4aRAIG .

scarry1992 commented 5 years ago

So, about example for it, you can try to connect to some broker(with updated webaocket-stream to 5.4.0 version) and look at socket frames. That`s enought. And you see: First frame: IMG_0792 Secont frame: IMG_0793

mcollina commented 5 years ago

Can you paste the code of the server?

scarry1992 commented 5 years ago

@mcollina, I can`t share code of my server, but test same with wss://iot.eclipse.org:443/ws

scarry1992 commented 5 years ago

@mcollina, I mean using with mqtt.js