Gravwell-Online/docs/events.md
2022-01-06 16:26:41 -07:00

58 lines
No EOL
1.6 KiB
Markdown

# Events
Every event in this document has two forms, a request and a response, the event
type can be differentiated by the event prefix, `req` is an event going to the
server, and `res` is a response coming from the server to the client. Some events
may only have one of these types, if this is the case, it will be denoted in the
relevant section.
**Important**: Events with the `Broadcasted` event type, must be listened to
even if you don't send any `Request` events of that type. This is because other
clients connected to the server may trigger the server in such a way that the
event response gets sent to multiple clients. **Broadcasted events will use the**
`res` **event type prefix.**
---
## `server.info`
Asks the server for information about it.
### Supported Event Types
| Request | Response | Broadcasted
| ------- | -------- | -----------
| Yes | Yes | No
### Payload Types:
Request Payload: N/A
Response Payload: `ServerInfoResponse`
---
## `lobby.create`
Creates a new game lobby for players to be able to join.
### Supported Event Types
| Request | Response | Broadcasted
| ------- | -------- | -----------
| Yes | Yes | No
### Payload Types:
Request Payload: `LobbyCreateRequest`
Response Payload: `LobbyCreateResponse`
---
## `lobby.join`
Joins the user into a game, the game must be in the lobby state in order to
join into it.
### Supported Event Types
| Request | Response | Broadcasted
| ------- | -------- | -----------
| Yes | Yes | No
### Payloads
Request Payload: `IGameJoinRequest`
Response Payload: `IGameJoinResponse`