I am sending data from a java server to a javascript
client via a websocket
in the following manner:
private byte[] makeFrame(String message) throws IOException { byte[] bytes = message.getBytes(Charset.forName("UTF-8")); ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); byteStream.write(0x81); byteStream.write(bytes.length); byteStream.write(bytes); byteStream.flush(); byteStream.close(); byte[] data = byteStream.toByteArray();}
But i am getting the error
Websocket connection to 'ws://localhost:8080/' failed: Invalid frame header
when the size is large (i believe above 128 bytes). I am unsure whether this is an issue with the op-code or something else.
Many thanks, Ben