Skip to content

Can I reuse buffer for another send/publish after calling ws.send(buffer)/app.publish("foo", buffer)? #1153

Answered by uNetworkingAB
josephrocca asked this question in Q&A
Discussion options

You must be logged in to vote

before that synchronous phase ends, is it safe to modify the buffer, and then send/publish it?

Yes if you don't change the size (obviously)

If I call ws.send(buffer) or app.publish("foo", buffer), then can i immediately use that buffer again?

Yes. The only call where this is not true, is tryEnd.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@josephrocca
Comment options

Answer selected by josephrocca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants