I found this library but I have no idea how to use it with Opium. They both seem to use cohttp though.
It’s not possible to use websockets in Opium becasue it’s not possible to use them in Cohttp. However, it is possible to setup a separate websocket server. This library is a good choice for this task:
Is it possible to set up the web socket server on the same port as the normal web server?
No, it is not possible. But it’s not necessary either. In an nginx based setup, you can tell nginx (for example) to proxy websocket connections different server. See this article for an example: https://www.nginx.com/blog/websocket-nginx/