Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 325128

Summary: WebSocket handshake fails when sending message during onConnect
Product: [RT] Jetty Reporter: Neil Dunn <neildunn>
Component: serverAssignee: Greg Wilkins <gregw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jetty-inbox
Version: unspecified   
Target Milestone: 7.1.x   
Hardware: All   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Example Websocket Javascript client
none
Example Server exhibiting bug. none

Description Neil Dunn CLA 2010-09-13 12:11:17 EDT
Build Identifier: jetty-distribution-7.1.6.v20100715

Using Jetty 7.1.6 and the stable branch of Google Chrome (6.0.472.55).

Sending a message in WebSocket#onConnect via Outbound#sendMessage causes the Websocket's handshake to fail.

An example snippet of code which exhibits the bug is attached.

Perhaps this is not a bug, but the API does not document this. It also worked in previous versions of Jetty + Chrome. (before the hixie hixie shake).

If it is not a bug, there should be a hook to know when one can actually send messages to the WebSocket.

Reproducible: Always

Steps to Reproduce:
1. Setup a Jetty server with the sample code
2. Run the main method
3. Connect to the server in Google Chrome
4. Click "Test"
5. The WebSocket receives an onclose event before an onopen event, representing a handshake failure.
Comment 1 Neil Dunn CLA 2010-09-13 12:13:08 EDT
Created attachment 178755 [details]
Example Websocket Javascript client
Comment 2 Neil Dunn CLA 2010-09-13 12:13:59 EDT
Created attachment 178756 [details]
Example Server exhibiting bug.
Comment 3 Greg Wilkins CLA 2010-09-14 05:14:20 EDT
fixed in r2272 and a few more test harnesses added for -75, -76, -00 and -01

cheers