Checklist¶
Check these before you hand in your client.
- WebSocket: send each line as its own message, without a newline. Each message you receive is one line.
- Telnet: end each line you send with a newline. Split what you receive on newlines.
- Right after you connect, say hello with your protocol version. The server waits for it.
- Log in only after the hello
OK. - Save your session token for reconnecting.
- Give every request its own
id(counting up works). - Remember which
ids are still waiting for an answer. - Don't expect the next line to be your answer. Events can come first.
- Use the match ID to know which match an event is for.
- Check the error code, not the error text.
- Got
FATAL? Connect again from the start. - Write commands in lowercase.
- Send data as one JSON object, made with a JSON library:
{"player": "jane doe"}. - WebSocket: keep reading messages, so your library answers the server's pings.
- Telnet: answer
PINGwithPONG. - Lost connection? Reconnect fast, with your session token.
- Got a
time_limitingame.your_turn? Move before it runs out. - Read
reasoningame.resultto know why a match ended. - One login per name. A name that is already logged in gives
AUTH_FAILED. - Only read the data fields you need. Others may change.