Handshake error when connecting via ws+unix
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- networking
Research direction
Start at ws4py.client.geventclient.WebSocketClient and its handling of ws+unix:///tmp/sock.sock, checking how host and port are populated before connect(). Reproduce the handshake with the Unix-socket example and verify that connecting works without manually assigning ws.port.
Written by the indexing model from the issue text.
Description
I have a WebSocket service that uses the gevent-websocket library. And ws4py connects to it via a Unix socket without issue.
Recently, I switched to flask-sock (uses simple-websocket under the hood) for the server.
And now handshake fails.
With trial and error (andd LLMs help), I discovered that a workaround is to set ws.port explicitly.
So, how I do it:
from ws4py.client.geventclient import WebSocketClient
_URL = "ws+unix:///tmp/sock.sock"
ws = WebSocketClient(_URL)
if ws.port is None:
if ws.scheme == "wss":
ws.port = 443
else:
ws.port = 80
ws.connect()
When the port is set, the handshake is now successful. Also, the port value is not important; even when set to "0", it works.
I see that the library always set the host (localhost in this case). Shouldn't the library also set the port?
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 285
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Lawouach/WebSocket-for-Python
-
question
Lawouach/WebSocket-for-Python#297 · 2 comments · 1 assignee ·
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
Lawouach/WebSocket-for-Python#296 ·
-
Lawouach/WebSocket-for-Python#280 · 1 comment · 1 assignee ·
-
Setup new CI Open
Lawouach/WebSocket-for-Python#275 · 1 assignee ·
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
Lawouach/WebSocket-for-Python#271 · 2 comments ·
All issues in Lawouach/WebSocket-for-Python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100