easywsclient icon indicating copy to clipboard operation
easywsclient copied to clipboard

Repeated messages.

Open edufgf opened this issue 8 years ago • 0 comments

Hi, I am using this lib to connect to a websocket. I am getting duplicate messages sometimes, and I don't think the problem is the socket source (who sends the messages). Is there any known bug related to duplicate messages??

I'm on linux and using threads.

EDIT: I was reading the lib code, and I think I found this 'bug'. Actually the handle_message dispatch callback can run after a poll(-1) 'supposedly' blocking (maybe it really is) and return no new message. The problem is that the dispatch function might not even call the callback function. I suggest modifying the dispatch function, and make it indicate whether there was a new message read from the socket.

I was assuming that when once poll(-1) returns then a new message was there and it was read with dispatch, but it is not quite the case. The poll function waits on a "select" call and I don't know why it returns even when there isn't exactly a "full message" or something like that, because the dispatch function have conditions to check if we really have a message (or a message that is readable by the current implementation).

edufgf avatar Jul 16 '16 05:07 edufgf