You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently have AsyncNextMessage(b []byte, ...) where the message's payload is read into b. The issue is that the payload is copied from the websocket's internal buffer into b. We can remove this copy. Two cases:
if the message is made up of a single frame, then just return the payload of that frame in the callback of the new function
if the message is made up of multiple frames, then return the payloads of all those frames in a callback
So the function signature would look something like this:
Then callers have the option to either read the fragments one by one or reassemble them. We can help with the reassembly by introducing a new construct: FrameAssembler. I think this one just needs to concatenate all []bytes. Callers will be expected to not hold onto the []bytes after the callback returns.
The text was updated successfully, but these errors were encountered:
We currently have
AsyncNextMessage(b []byte, ...)
where the message's payload is read intob
. The issue is that the payload is copied from the websocket's internal buffer intob
. We can remove this copy. Two cases:So the function signature would look something like this:
Then callers have the option to either read the fragments one by one or reassemble them. We can help with the reassembly by introducing a new construct:
FrameAssembler
. I think this one just needs to concatenate all[]byte
s. Callers will be expected to not hold onto the[]byte
s after the callback returns.The text was updated successfully, but these errors were encountered: