[WebSocket] Echo back a Closeframe by a client

User Help for Mozilla Firefox
New Member
Posts: 1
Joined: July 10th, 2018, 10:17 pm

Post Posted July 10th, 2018, 10:21 pm


According to the WebSocket spec:

If an endpoint receives a Close frame and did not previously send a Close frame, the endpoint MUST send a Close frame in response.

I wrote a server that initiates connection close by sending a close frame and then it awaits for an echoed back close frame from the client and then closes the TCP connection.

I used firefox and chrome javascript client to test this behavior:

Code: Select all
//make connection
var ws = new WebSocket("ws://localhost:9090/basic/ws", "xml", "my-protocol");
ws.onclose = function(frame) {console.log(frame)};
//ask server to close connection

The issue is that both the firefox and chrome clients do not echo back a close frame to my server when the server initiates the close by sending the close frame(I can see this close frame logged in the console).

I don't think both firefox and chrome javascript clients are violating WebSocket protocol. Can anyone explain why server does not receive the echoed close frame when it initiates close? Is there any issue with the javascript code?
Stackoverflow issue: ... ates-close


Return to Firefox Support

Who is online

Users browsing this forum: No registered users and 13 guests