Skip to content

Asyncronous API callbacks #737

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

Closed
RobPhippen opened this issue Jul 12, 2016 · 3 comments
Closed

Asyncronous API callbacks #737

RobPhippen opened this issue Jul 12, 2016 · 3 comments

Comments

@RobPhippen
Copy link

This issue description is work in progress This is one of three items agreed to be split out from #716 (see this note).

Summary

This issue covers a syntax to enable asynchronous callbacks to be specified.

@fehguy
Copy link
Contributor

fehguy commented Jul 28, 2016

Some feedback on this.

Conceptually:
I don't know that this makes sense. To me, there are differences between async responses and callbacks. An async response will be sent, in-band, after a connection is negotiated with the server. An example would be a websocket or an HTTP-long poll. The "trigger" for the response is typically very specific to HTTP connection types, such as interrupting the connection stream, negotiating a 101, etc.

On the other hand, a callback is more of what a webhook would perform--that is, posting directly to a URL, as specified by the caller. While it is async, the connection is broken between negotiation and processing.

This proposal doesn't really cover either of those two. If we're looking to define an async response, we'll have to make it clear how the connection is negotiated and what the trigger would be, if any (it could simply be a socket, but that's outside raw HTTP 1.1). If we're looking to define a callback, we need to make the callback URL part of the request. I guess that's what #735 is for, but it doesn't seem like they're related correctly

Structurally:

  • On the x-async-responses: A formal support means no extension (x-). I suggest asyncResponses
  • Use a hash instead of array for items in the asyncResponses
  • The value for the items in the asyncResponses is essentially an operation, it should simply adhere to that schema
  • discriminator doesn't make sense to me. If the payload is what varies, then we should use the standard payload mechanism for determining what type of object is being sent back

@darrelmiller
Copy link
Member

There is also other precedents for the use of the term async in HTTP. The prefer header uses the respond-async to describe an interaction that returns a 202 and the client must make a second request to get the results.
It would probably be wise not to introduce more ambiguity in what async means for HTTP.

@fehguy
Copy link
Contributor

fehguy commented Feb 1, 2017

Closing as #763 has been merged.

@fehguy fehguy closed this as completed Feb 1, 2017
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

No branches or pull requests

3 participants