transport: option to set the WS and WSS handshake path - #339
Open
Mliviu79 wants to merge 2 commits into
Open
Conversation
added 2 commits
July 19, 2026 09:58
NewTransportLayer sets a DialURI default for WSS, but TransportWSS declares its own CreateConnection, which shadows the promoted TransportWS method and builds the handshake URL from a hardcoded "wss://" + addr. The field is never read on that path, so a caller setting a handshake path has no effect over WSS and the dialer always requests /. CreateConnection now reads t.DialURI(addr). TransportWSS.init sets the wss:// default before calling TransportWS.init, which would otherwise default it to ws:// and dial the wrong scheme over TLS. Refs emiago#319
Most SIP over WebSocket servers expect /ws, while the dialer requests /. DialURI already expresses this but nothing could set it, so the path was reachable only by supplying a whole transport through TransportsConfig. Set it per transport layer instead of a package global, so two user agents in one process can dial different paths. Refs emiago#338
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #338
Stacked on #320, which makes WSS honour
DialURIat all. Please take that first — the diff here is only the option on top.Most SIP over WebSocket servers expect
/wswhile the dialer requests/.DialURIalready expresses this, but nothing could set it short of supplying a whole transport throughWithTransportLayerTransports— which means hand-constructingTransportWS/TransportWSSjust to change a path.WithTransportLayerWSDialPathappends a handshake path to the default WS and WSSDialURIbuilt inNewTransportLayer. Per transport layer rather than a package global, so two user agents in one process can dial different paths. Ignored for a transport supplied throughWithTransportLayerTransports, since that one carries its ownDialURI.One exported option, no behaviour change when unset.