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

how to integrate websockets, should the need arise? #570

Open
VuongUranus opened this issue Sep 10, 2024 · 4 comments
Open

how to integrate websockets, should the need arise? #570

VuongUranus opened this issue Sep 10, 2024 · 4 comments
Labels
question Further information is requested

Comments

@VuongUranus
Copy link

how to integrate websockets, should the need arise?

@danielgtaylor danielgtaylor added the question Further information is requested label Oct 8, 2024
@danielgtaylor
Copy link
Owner

@VuongUranus you have full access to the underlying router and can use any websocket library compatible with your router choice (or the router itself it it supports websockets directly). If you want some of the Huma goodies like validation of request inputs then you can take a look at the SSE package as it implements SSE support on top of a streaming response within Huma: https://github.com/danielgtaylor/huma/blob/main/sse/sse.go and https://huma.rocks/features/server-sent-events-sse/.

@lei-lei-shanda
Copy link

It would be great if web socket + AsyncAPI 2.x is supported out of box though. For the time being, the above trick would do.

Async API: https://www.asyncapi.com/en

@noor-tg
Copy link

noor-tg commented Oct 22, 2024

I think this needs to be added from multiple perspectives :

  • websocket framework integration
  • huma way to make asyncapi docs in code
  • export to separate docs websocket from the main docs

@danielgtaylor
Copy link
Owner

I would be open to someone adding support for this to Huma if it makes sense, otherwise this could maybe be an additional library on top of or next to Huma. I'm not super familiar with AsyncAPI so would love to see some examples of how you expect to use it with Huma 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants