tourist-ws/route
src/tourist-ws/route.tur
defn
ws-route!
(ws-route! [path : cstr ^fat handler : (fn [WsConn])
declare a tourist route that upgrades to a WebSocket.
Parameters
| path | route pattern string, e.g. "/ws" or "/feed/:room". | |
| handler | (fn [WsConn] void), run after a successful upgrade. |
Returns
:int -- a tourist route Item, to be passed to tourist-conn.
Example
(ws-route! "/echo"
(fn [ws : WsConn] : void
(let [f (ws-server-recv ws)]
(ws-server-send ws (ws-frame-text f))
(ws-server-close ws))))
Since: TOUR-V0