Skip to content

Bring sync client to feature parity - #1748

Open
aaugustin wants to merge 7 commits into
mainfrom
sync-client-feature-parity
Open

Bring sync client to feature parity#1748
aaugustin wants to merge 7 commits into
mainfrom
sync-client-feature-parity

Conversation

@aaugustin

@aaugustin aaugustin commented Aug 18, 2026

Copy link
Copy Markdown
Member

No description provided.

@aaugustin
aaugustin force-pushed the sync-client-feature-parity branch 3 times, most recently from c49b1ff to 18cfa5d Compare August 19, 2026 06:13
@aaugustin
aaugustin force-pushed the sync-client-feature-parity branch from 18cfa5d to 359a1be Compare August 20, 2026 06:57
This usage was never shown in examples, but it was clearly described in
the documentation and it must exist in the wild.

Add a flag for backwards compatibility. While the name implies that it
should go away in the long run, it isn't immediately deprecated. Its
name provide light deterrence, which is enough for now.
@aaugustin
aaugustin force-pushed the sync-client-feature-parity branch 2 times, most recently from 3664bad to af045ec Compare August 21, 2026 07:26
@aaugustin
aaugustin marked this pull request as ready for review August 21, 2026 07:27
@aaugustin
aaugustin force-pushed the sync-client-feature-parity branch from af045ec to 55e36e8 Compare August 21, 2026 07:28
@aaugustin
aaugustin requested a balanced review from Copilot August 21, 2026 07:28
@aaugustin
aaugustin force-pushed the sync-client-feature-parity branch from 55e36e8 to 4c020d3 Compare August 21, 2026 07:32
@aaugustin
aaugustin dismissed a stale review August 21, 2026 07:33

no idea who this is, this user doesn't even exist

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds redirect handling, automatic reconnection, and connection API parity to the synchronous client.

Changes:

  • Adds sync reconnection and redirect support.
  • Introduces context-manager migration behavior and Unix/TCP improvements.
  • Expands parity tests and documentation.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/websockets/sync/client.py Implements reconnect and redirect APIs.
src/websockets/sync/connection.py Adds legacy-usage warnings.
src/websockets/sync/server.py Restricts TCP options to IP sockets.
src/websockets/trio/client.py Refines connection and Unix handling.
src/websockets/asyncio/client.py Refactors direct connection setup.
tests/sync/test_client.py Tests new sync client behavior.
tests/sync/test_server.py Uses shared server address handling.
tests/sync/test_router.py Updates sync redirect coverage.
tests/sync/server.py Refactors sync test helpers.
tests/trio/test_client.py Expands lifecycle and Unix tests.
tests/trio/test_server.py Updates listener address handling.
tests/trio/test_router.py Shares router test configuration.
tests/trio/server.py Refactors Trio server helpers.
tests/asyncio/test_client.py Expands lifecycle parity tests.
tests/asyncio/test_router.py Shares router test configuration.
docs/reference/sync/client.rst Documents new sync APIs.
docs/reference/features.rst Marks sync parity features.
docs/project/changelog.rst Records new sync capabilities.
Makefile Changes the default test target.
Suppressed comments (1)

src/websockets/sync/client.py:696

  • This example is for the synchronous API, so connect() isn't awaitable. Copying it produces invalid usage (and a TypeError if placed in an async function); call it directly as the warning text and new tests do.
        websocket = await connect(..., legacy=True)

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

path: str | None = None,
uri: str | None = None,
*,
legacy: bool | None = None,
Comment thread Makefile

tests:
python -m unittest
python -m unittest tests/sync/test_client.py -v
"""
Similar to :func:`connect`, with support for automatic reconnection.

:func:`reconnect` can also be treated as an infinite asynchronous iterator

.. autofunction:: unix_reconnect

.. autofunction:: process_exception
Comment on lines 862 to +864
def unix_connect(
path: str | None = None,
uri: str | None = None,
**kwargs: Any,
) -> ClientConnection:
*args: Any, legacy: bool | None = None, **kwargs: Any
) -> ClientConnection | reconnect:
Comment on lines +702 to +703
def maybe_raise_legacy_warning(self) -> None:
pass # see override in ClientConnection
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

Successfully merging this pull request may close these issues.

2 participants