I want to migrate two applications in rust to a web-framework for its API. I am trying to figure out which web-framework to choose and am hoping to get some feedback from people who tried to use the same features.
The first currently uses hyper directly, the second uses polling on mysql as it’s “API” and is currently being upgraded from 2015-ish Rust to 2018 edition. Both boil down to nearly the same requirements for a web framework:
- REST-like API (post/get to different paths with JSON & JSON response)
- web-sockets to ping-back clients after work is done and broadcast to all when for example the global queue changes.
- being able to run some blocking stuff (DB) /things in tokio and then kick off the broadcast / client ping back. (So not entirely an action-reaction system as many async-libs are having in their examples.)
- Stable rust, can be latest
Libraries I’ve looked into:
- tower-web: currently doesn’t build and throws “not yet implemented” errors with its examples (trying to use extract, response)
- warp: seems a direct competitor to tower-web, so which one to pick ?! Both seem to have some kind of stale development lately. This can be totally fine but I can’t really see whether it’s finished for my case or not.
- actix: As of now the most mature. I’ve already written one rest-like API with it, but nothing out of the action-reaction scheme. Also I’m still concerned about it’s current state regarding unsafe transmutations to &mut internally.
For websockets I’ve found a multitude of specific frameworks only to handle these. As I need some kind of authentification to reply to specific users for their request, getting websockets from the same framework used for the REST-API is probably better.
I’m happy to answer questions as I’m sure that I wasn’t able to perfectly describe my needs.