Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification on WebSocket Client Support – Missing HTTP GET Handshake Implementation? #289

Open
monishkumardurairaj opened this issue Mar 13, 2025 · 1 comment

Comments

@monishkumardurairaj
Copy link

I am currently working with Sofia-SIP 1.13.17 and trying to establish a WebSocket (WS/WSS) client connection for SIP over WebSockets. However, I am unable to find where the WebSocket client initiates the HTTP GET handshake request (Upgrade: websocket).

Observations:
Server-Side WebSocket Handling Exists:

I found that ws_handshake() in ws.c handles the WebSocket handshake, but it appears to be for server-side requests, where it processes incoming WebSocket connections and sends a 101 Switching Protocols response.
Expected Client-Side WebSocket Handshake:

For a WebSocket client, I expect Sofia-SIP to send a GET request similar to:
http
GET /sip HTTP/1.1
Host: example.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: BASE64_ENCODED_KEY
Sec-WebSocket-Version: 13
However, I do not find this request being generated anywhere in the Sofia-SIP client-side transport functions.
Tracing the Flow for WSS Client:

When attempting a WebSocket client connection, the flow reaches:

tport_base_connect() → tport_alloc_secondary() → tport_ws_init_secondary() → WS_INIT() → establish_logical_layer() → ws_handshake()
Since ws_handshake() mainly processes incoming WebSocket requests, I expected the HTTP GET request for the client-side handshake to be constructed earlier, but I don’t see where that happens.

Key Questions:
Does Sofia-SIP 1.13.17 fully support WebSocket client connections (ws:// and wss://)?
Where is the HTTP GET request for the WebSocket handshake constructed and sent in the client-side code?
Is there an alternative way to properly initiate a WebSocket client connection in Sofia-SIP?
If client-side WebSocket support is incomplete, what would be the best way to extend Sofia-SIP to include it?
Would appreciate any insights or guidance on this! Thanks in advance. 😊

@seven1240
Copy link
Contributor

No, but you can find client support in libks https://github.com/signalwire/libks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants