Skip to content

Update Client.connect(transport:) to automatically send initialize request #100

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

mattt
Copy link
Contributor

@mattt mattt commented May 6, 2025

See #97 (comment)

Other SDKs have clients automatically send initialize message when connecting to a server. This PR updates our implementation to do the same. Beyond consistency, this helps mitigate an invisible time dependency / race condition for clients with streamable HTTP transport, as the client waits for a session ID before subscribing to SSE events. If the API consumer failed to call initialize immediately after connecting, this could result in SSE subscriptions timing out.

This PR deprecates the existing Client.initialize method. This method will be removed in a future version (or more accurately, it will be made private and replace the current private func _initialize method).

@mattt mattt marked this pull request as ready for review May 6, 2025 17:11
@mattt mattt force-pushed the mattt/initialize-on-connect branch from 576445b to e257521 Compare May 6, 2025 18:53
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.

1 participant