WebSockets
Functions annotated with @web_endpoint, @asgi_app, or @wsgi_app also support the WebSocket protocol. Consult your web framework for appropriate documentation on how to use WebSockets with that library.
WebSockets on Modal maintain a single function call per connection, which can be useful for keeping state around. Most of the time, you will want to set your handler function to [allow concurrent inputs](https://modal.com/docs/guide/concurrent-inputs), which allows multiple simultaneous WebSocket connections to be handled by the same container.
We support the full WebSocket protocol as per [RFC 6455](https://www.rfc-editor.org/rfc/rfc6455), but we do not yet have support for [RFC 8441](https://www.rfc-editor.org/rfc/rfc8441) (WebSockets over HTTP/2) or [RFC 7692](https://datatracker.ietf.org/doc/html/rfc7692) (permessage-deflate extension). WebSocket messages can be up to 2 MiB each.
... but I can't figure out how to actually make it work... could you create an example please?
Your documentation says this:
... but I can't figure out how to actually make it work... could you create an example please?