Skip to content
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

Sequential replies: a single request can have multiple responses #83

Merged
merged 13 commits into from
Apr 6, 2022

Conversation

jakaplan
Copy link
Contributor

@jakaplan jakaplan commented Apr 4, 2022

This introduces the ability for a client to make a request that the server can respond to arbitrarily many times. It's exposed as either as an AsyncThrowingStream or for closure-based callbacks uses a custom SequentialResult type. This allows a server to essentially stream data to a client and should avoid needing a client to do any sort of polling.

Under the hood the server is now able to make calls to the client which aren't actually XPC replies, but this is intentionally not directly exposed to SecureXPC API users. This limits the conceptual complexity of the framework (e.g. no registration of routes with the client which the server would then send to) while still allowing most bidirectional scenarios.

A few tests were added to ensure the most common scenarios work as expected, but I'm intending to add some more before merging this,

@jakaplan
Copy link
Contributor Author

jakaplan commented Apr 4, 2022

@amomchilov Will leave this up for at least a couple days before merging if you'd like to review it beforehand.

@jakaplan jakaplan merged commit fda3ae6 into main Apr 6, 2022
@jakaplan jakaplan deleted the async-sequence branch April 6, 2022 11:00
@amomchilov
Copy link
Contributor

Heyo, sorry for going dark, I was out on vacay. This is pretty complex stuff, I'll dig into it! I'll let you know if I have any questions/thoughts!

@jakaplan
Copy link
Contributor Author

jakaplan commented Apr 8, 2022

No worries! There was a follow up PR after this one that did a bit of cleanup and ensures a transaction is held open, so probably best to look at both (or maybe together? I'm no git expert).

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.

None yet

2 participants