Difference between revisions of "AAGRINDER socket.io api"
imported>Maze (creat) |
m (mark out of date) |
||
Line 1: | Line 1: | ||
AAGRINDER uses the [https://socket.io socket.io] library for most of the communication between the AAGRINDER server and the AAGRINDER clients. | AAGRINDER uses the [https://socket.io socket.io] library for most of the communication between the AAGRINDER server and the AAGRINDER clients. | ||
This page describes all the different messages that can be sent between the server and the client over socket.io. | This page describes all the different messages that can be sent between the server and the client over socket.io. | ||
+ | |||
+ | '''This page is out of date! The API may be different than described.''' | ||
== Endpoints on the server == | == Endpoints on the server == |
Latest revision as of 09:33, 5 July 2024
AAGRINDER uses the socket.io library for most of the communication between the AAGRINDER server and the AAGRINDER clients. This page describes all the different messages that can be sent between the server and the client over socket.io.
This page is out of date! The API may be different than described.
Endpoints on the server[edit]
This section describes all the messages that can be sent from the AAGRINDER client to the AAGRINDER server.
The items under Data need to be present in the message, otherwise the message is ignored. The examples are written as code you would run on the client.
Login[edit]
Attempts to log in a player
Endpoint[edit]
'login'
Data[edit]
{ username:[string], password:[string] }
Sample code[edit]
socket.emit('login', {username:'original', password:'hihi'});
Chat message[edit]
Sends a chat message to all other clients, or runs a server-side command. Only works if player is logged in.
Endpoint[edit]
'chat'
Data[edit]
{ message:[string] }
Sample code[edit]
socket.emit('chat', {message:'hi!'});
Change player color[edit]
Endpoint[edit]
'changecolor'
Game tick[edit]
Endpoint[edit]
't'
Submit debug logs[edit]
Endpoint[edit]
'debuglog'
Endpoints on the client[edit]
This section describes all the messages that can be received on the AAGRINDER client from the AAGRINDER server.
The items under Data are always present in the message received from the server, unless they are marked with ?, in which case they are optional. The examples are written as code you would run on the client.
Login success[edit]
Endpoint[edit]
'loginsuccess'
Sample code[edit]
socket.on('loginsuccess', data => console.log(data));
Login error[edit]
Endpoint[edit]
'loginerror'
Sample code[edit]
socket.on('loginerror', data => console.log(data));
Force reload[edit]
Endpoint[edit]
'FORCERELOAD'
Sample code[edit]
socket.on('FORCERELOAD', data => console.log(data));
Chat message[edit]
Endpoint[edit]
'chat'
Sample code[edit]
socket.on('chat', data => console.log(data));
Terrain update[edit]
Endpoint[edit]
't'
Sample code[edit]
socket.on('t', data => console.log(data));