public void sendMessage(byte[] content, int offset, int length) throws IOException
{
if (_closedOut)
throw new IOException("closedOut "+_closeCode+":"+_closeMessage);
_outbound.addFrame((byte)FLAG_FIN,WebSocketConnectionRFC6455.OP_BINARY,content,offset,length);
checkWriteable();
}
the question is "byte[] data" is temporary or buffered.
http://stackoverflow.com/questions/11797708/jetty-websocket-custom-events
"jetty-websocket没有为子协议解析提供好的注入架构,对于pushserver而言效率和定制性问题 如binarymessage完整接收后返回对应拷贝,上层无法对这个buffer copy过程和子协议解析做精确控制,造成内存碎片等问题"
is it right?
There is no need to discuss textmessage.
how about binary message?
http://grepcode.com/file/repo1.maven.org/maven2/org.eclipse.jetty/jetty-websocket/8.1.7.v20120910/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java#444
the question is "byte[] data" is temporary or buffered.
http://grepcode.com/file/repo1.maven.org/maven2/org.eclipse.jetty/jetty-websocket/8.1.7.v20120910/org/eclipse/jetty/websocket/WebSocketGeneratorRFC6455.java?av=f#158
byte[] always provided with offset and length, it's buffered in jetty, so, you also need care about you buffer self
once copy for send: your-buffer -> jetty-buffer
once copy for receive: jetty-buffer -> your-buffer