Java-WebSocket: ByteBuffer is empty when sent from the server

I sent some bytes from the server to a client, but the ByteBuffer on the client end is empty.

I can confirm that the buffer is populated serverside

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22

Most upvoted comments

Something I noticed: When I pass a ByteBuffer, it is empty on the other side.
So I’ll just be using .array() from now on.

I’m using ByteBuffer.wrap before sending it, so there’s definitely an array there.

When I passed the ByteBuffer instead of the ByteBuffer.array, the server wasn’t receiving anything at all.
Am I supposed to use .position(0) every single time?