mkuklis / phonegap-websocket

Websocket PhoneGap plugin for Android
203 stars 78 forks source link

Fragmentation Support #18

Open rgillan opened 11 years ago

rgillan commented 11 years ago

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.

mkuklis commented 11 years ago

@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.

rgillan commented 11 years ago

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 notifications@github.com 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 commented 11 years ago

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.

mkuklis commented 11 years ago

@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.