How can I serve static files, and route request for serving html at ‘/’ and websocket handler at ‘/ws’, for example? It could be good tutorial for using hyper + ws + tokio
I don’t know of any good tutorials on using hyper + ws + tokio, but I know mdbook use ws and synchronous hyper to serve a book locally. It’s probably not the prettiest code, but you may be able to use that as an example.
EDIT: I just realised that
ws have a guide on their website. You may want to give that a shot.
Yeah, it’s good for setting up
ws-server, but main idea is using 1 async server for both - websockets and simple http requests.