phonegap-websocket icon indicating copy to clipboard operation
phonegap-websocket copied to clipboard

Fragmentation Support

Open rgillan opened this issue 11 years ago • 4 comments

The underlying websocket library supports the reception of message fragments, returning them to onFragment for reassembly and passing onwards to Cordova. We have verified that the fragments hit the plugin (CordovaClient.java) when the server fragments the message. This is needed to reliably support large messages.

rgillan avatar Sep 24 '13 02:09 rgillan

@rgillan I've added onFragment but I'm not sure if the implementation is correct. I'm worry that if the fragmented data will be sent without isFin flag set it could potentially cause issues. Please give it a try and see what happens. Maybe we could consult with Nate and get his feedback on this.

mkuklis avatar Sep 24 '13 12:09 mkuklis

Michal,

Thanks for this, will be testing tomorrow (Mac our platform guy has been fighting the latest Xcode update and Cordova 3 on iOS today). Looked at your code and it's straightforward, although you're right in being dependent upon isFIN coming from the library. Will know tomorrow and let you know.

Thanks Rob

On 24/09/2013, at 10:38 PM, Michal Kuklis [email protected] wrote:

@rgillan I've added onFragment but I'm not sure if the implementation if correct. I'm worry that if the fragmented data will be send without isFin flag set it could potentially cause issues. Please give it a try and see what happens. Maybe we could consult with Nate and get his feedback on this.

— Reply to this email directly or view it on GitHub.

rgillan avatar Sep 25 '13 07:09 rgillan

We've posted issue #209 in Nate's library as we are seeing fragmentation errors on very large frames. For smaller frames (70kB, 5 fragments of 16kB over the wire) it works well, but when the packet size goes up (tested at 470kB) it doesn't work as expected.

rgillan avatar Sep 27 '13 00:09 rgillan

@rgillan thanks for the heads up. Can you post what kind of errors you are getting? I could also change the implementation and don't rely on Framedata.append and use StringBuffer.

mkuklis avatar Sep 27 '13 08:09 mkuklis