Rust server, which takes ticker prices from coinbase and returns them through graphql API.
Also working on exposing websocket which subscribes to coinbase websocket server and will save prices in redis.
In order to run the server you need to have flyway and sqlite installed.
More info on that can be found in db/README.md
file.
To run rust server with hot-reload:
cargo watch -x 'run' --watch src
Linting and formatting:
cargo fmt --all
cargo clippy --all --tests
Code to subscribe to local WS
const ws = new WebSocket("ws://127.0.0.1:8080/ws")
ws.onopen = (event) => {
console.log("sending echo")
ws.send(
JSON.stringify({
event: "echo",
data: {
message: "hello",
},
})
)
}
ws.onmessage = (event) => {
const msg = JSON.parse(event.data)
console.log("received msg", msg)
}