TooTallNate / Java-WebSocket

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

Websocket Upgrade connection #1386

Closed krishnak closed 4 months ago

krishnak commented 4 months ago

Hello, An excellent work - congratulations. I am trying to connect to a third party server which upgrades the HTTP connection to a websocket connection using sec-websocket-version header. I am enclosing the relevant headers I captured via Wireshark for the TLS request.

I looked at your examples, I found an example for SSL Client, I also found an example for sec-websocket-protocol.

However I didn't find any explicit examples for connection upgrade. Could you please advise whether your library supports my requirement? If so could you post some pseudocode.

Screenshot from 2024-01-14 20-08-31

marci4 commented 4 months ago

Hello @krishnak, it looks like the attached screenshot is from a browser judging by the Origin header.

I am not aware of any upgrade from http to ws. Just use the normal scheme ws and wss for encrypted communication.

Best regards, Marcel

krishnak commented 4 months ago

You can have a look at asynchttp client, if you choose to implement this http to websocket upgrade feature.