After this thing with the form writer, I began looking at the WebSocket implementation in the lib. In fact, I am currently using LibSourcey to play with the Discord WebSocket protocol, so I've got some test material here.
The main pitfall I have encountered up to now is that whenever data is fragmented (as in, sometimes I do not get the entire WebSocket frame in one onSocketRecv call), the WebSocketFramer fails to parse the frame, as it is not complete (this line is reached).
My thoughts about this is that we should wait for the entire frame to be received before beginning to parse it, however it involves some sort of data buffering in the WebSocketAdapter instance itself, or perhaps elsewhere.
As an exception is immediately raised, it is quite the problem to see if the next payload of data provided to onSocketRecv is indeed the rest of the "incomplete" WebSocket frame.
Maybe the readFrame method of the WebSocket parser should return some sort of error code meaning that it needs more data in order to correctly process the WebSocket frame.
Hope this will be fixed soon!
Edit: Maybe we should do the buffering thingy inside of the WebSocketFramer itself. That would do the trick.
Hi Kam!
After this thing with the form writer, I began looking at the WebSocket implementation in the lib. In fact, I am currently using LibSourcey to play with the Discord WebSocket protocol, so I've got some test material here.
The main pitfall I have encountered up to now is that whenever data is fragmented (as in, sometimes I do not get the entire WebSocket frame in one
onSocketRecv
call), theWebSocketFramer
fails to parse the frame, as it is not complete (this line is reached). My thoughts about this is that we should wait for the entire frame to be received before beginning to parse it, however it involves some sort of data buffering in theWebSocketAdapter
instance itself, or perhaps elsewhere. As an exception is immediately raised, it is quite the problem to see if the next payload of data provided toonSocketRecv
is indeed the rest of the "incomplete" WebSocket frame.Maybe the
readFrame
method of the WebSocket parser should return some sort of error code meaning that it needs more data in order to correctly process the WebSocket frame.Hope this will be fixed soon!
Edit: Maybe we should do the buffering thingy inside of the
WebSocketFramer
itself. That would do the trick.