anismiles / websocket-android-phonegap

This is a Java library that implements Websockt API (Draft-75/76) for Android platform. Library uses java.nio.* packages for efficient non-blocking evented behavior. It easily gets integrated with Phonegap framework.
http://wp.me/pVyFz-qO
MIT License
322 stars 137 forks source link

Key3 as a seperate frame #1

Closed FourFourTwo closed 13 years ago

FourFourTwo commented 13 years ago

For the Draft76 handshake request, when it was calling Write() a second time specifically for the key3 bytes, it causes those last 8 bytes to be sent across the wire in a second packet, separate from the initial GET handshake request. This was causing very frequent yet sporadic non-connects for me (server would reply with 501 because the it didn't get the third key in time).

I just added a small chunk of code that ensures all three of the websocket keys get sent in that first inital packet.

Chrome/Safari both send everything in the first packet, looks like that is what the spec intended as well.

PS. THIS PROJECT WAS A LIFE SAVER!!!

anismiles commented 13 years ago

Glad that it could help you. :) thanks for the PULL.