I'm building an application using Jetty WebSockets that sends a very large stream of binary from the client to the server. That is, it's a streaming upload that involves several Javascript calls to connection.send(block), where each block is an ArrayBuffer of up to 1 MB in size. This is done completely asynchronously, so that a subsequent call to connection.send does not occur until a prior one completes successfully.
On the other end, I've (so far) implemented OnBinaryMessage and OnTextMessage. It was working pretty well, but during testing I was seeing messages to the effect of "binary frame aggregation disabled." During onOpen, I tried calling connection.setMaxBinarySize(2048*512), but this failed as well. When I doubled that size, it worked, but it seems silly to allocate 2 MB when I might need as little as 512 bytes, and it definitely feels like I'm solving the wrong problem at this point. On the server side, I really don't need any aggregation at all; I'm simply writing data[offset:offset+length] to a PipedOutputStream, where the input side is read by another thread. What is the best way to simply pass off binary data in this way, without performing any aggregation? It seems that I need to implement WebSocket.OnFrame, but I could not find any helpful documentation for it. Can I simply return false if it is a text frame, and handle it if it is a binary frame? How do I check opcode to determine whether it is binary? If I'm handling binary messages using an onFrame method, do I no longer need to implement OnBinaryMessage? Do I need to do anything special with the flags argument? When is onHandshake called? Is there anything that must be done there? Thank you for any insight you can give me. If you can simply point me to documentation (the source as downloaded via maven has none), I'm happy to dig into it myself. Cheers, Brandon _______________________________________________ jetty-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/jetty-users
