AnswerDotAI / AnswerDotAI/jupyasyncclient
wss:// connections fail on websockets>=14: ssl=None is incompatible with a wss:// URI
- Dominant language
- Jupyter Notebook
- Stars
- 0
- Forks
- 0
- Avg merge
- 1m
- Merged PRs (30d)
- 3
Description
With `websockets>=14` (the current pin is `websockets>=13`), any verified `wss://` connection fails at `_start_ws`:
```
ValueError: ssl=None is incompatible with a wss:// URI
```
`KernelApi._ws_ssl` returns `None` for a verified wss URL, documented as "the library default". Older websockets treated `None` that way; since 14 it requires `True` (or a context) for wss ([websockets changelog](https://websockets.readthedocs.io/en/stable/project/changelog.html)). Unverified wss and plain ws are unaffected.
Repro (websockets 17.0.1, any wss gateway, e.g. a solveit instance):
```python
from jupyasyncclient import JupyAsyncKernelClient
await JupyAsyncKernelClient.connect('https://', token=...) # -> ValueError above
```
Fix that works for me:
```python
def _ws_ssl(self, url):
"For wss: `True` (the library default context) when `verify`, else an unverified context; None for ws."
if not url.startswith('wss'): return None
if self.verify: return True
ctx = ssl.create_default_context()
ctx.check_hostname,ctx.verify_mode = False,ssl.CERT_NONE
return ctx
```
Happy to send this as a PR from a fork if useful.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01YQFobMdGs4L84whox98NR2
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at KernelApi._ws_ssl and its caller _start_ws, then compare verified wss:// behavior with unverified wss:// and plain ws:// under websockets 14+. Reproduce the reported connection failure first. Done means verified wss:// connections succeed without the ValueError while the unaffected paths retain their existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 78/100