Categorygithub.com/Cyliann/go-dice-roller
repository
0.0.0-20240225141532-c7e0f3c3c5ec
Repository: https://github.com/cyliann/go-dice-roller.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

:game_die: A backend for multiplayer dice rolling :game_die:

Written in Go using Server-Sent Events

Endpoints:

  • /play Subscribe to SSE. Returns an ID of a subscribed stream '{ "room": string }'
KeyValue
roomstring
  • /roll Triggers a roll request with '{ "dice": { "id": nrOfSides } }' (allows for multiple rolls and keeps the order)
KeyValue
dice{ "id" : nrOfSides }

Example body of request: '{ "dice": { "0": 6, "1": 10, "2": 20 } }'

Responds with an SSE Event with a username of the roller, id of the stream and the result of the roll '{ "username": string, "room": string, "result": uint8 }'

KeyValue
usernamestring
roomstring
resultint