trillium-rs / trillium

Trillium is a composable toolkit for building internet applications with async rust

Home Page:https://trillium.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug report for `trillium-api`: Doesn't support `upgrade`/`has_upgrade` for WebSocket

joshtriplett opened this issue · comments

trillium_api::ApiHandler does not handle API calls that want to upgrade, so it doesn't work for WebSocket connections. It would be convenient to receive incoming parameters via FromConn and then establish a WebSocket connection.

I don't think this fits with the intent of trillium-api, but this likely indicates that the documentation for trillium-api needs work. trillium-api is specifically intended to be used for rest-style json endpoints, and anything more complex than that should be expressed in trillium::Handler types

Edit: On further consideration, it makes sense to support the full Handler lifecycle on returned Handlers. There's very little downside and it is less surprising. That said, it seems like trillium-api is likely usable more broadly than it was initially intended, and is possibly misnamed.