TooTallNate / Java-WebSocket

A barebones WebSocket client and server implementation written in 100% Java.
http://tootallnate.github.io/Java-WebSocket
MIT License
10.53k stars 2.58k forks source link

How many times WebSocket handshake? #1318

Closed xxxga0 closed 1 year ago

xxxga0 commented 1 year ago

In these code:

private boolean decodeHandshake(ByteBuffer socketBufferNew) {
 ...
            if (handshakestate == HandshakeState.MATCHED) {
                ...

                  write(d.createHandshake(
                      d.postProcessHandshakeResponseAsServer(handshake, response)));
                  draft = d;
                  open(handshake);
                  return true;
                }
}

Why server accept handshake, the WebSocket open directly. Isn't it three-way handshake?

lakeoffaith commented 1 year ago

just read 1.3

PhilipRoman commented 1 year ago

Closing as there is no specific issue - the current implementation conforms to the spec and has been tested carefully.