crysocket

Crystal Timestamp Websocket Server

crysocket

Travis build status Heroku

A basic Kemal toy application which serves a timestamp over websockets and a JSON endpoint.

Usage

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://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

Repository

crysocket

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 2
  • about 7 years ago
  • October 30, 2017
License

MIT License

Links
Synced at

Sat, 23 Nov 2024 13:53:05 GMT

Languages