A basic Kemal toy application which serves a timestamp over websockets and a JSON endpoint.
First install Crystal if you don't already have it. Then in the checkout of this repository:
$ shards install
$ crystal build --release src/crysocket.cr
$ ./crysocket
To test, open a browser tab and enter the following into the developer javascript console:
ws = new WebSocket("wss:https://crysocket.herokuapp.com/socket")
ws.onmessage = msg => console.log(msg.data)
The timestamp should update approximately every second.
Alternatively, access the GET endpoint at https://crysocket.herokuapp.com/time