Skip to main content
Remote Control

WebSocket Events

A live event stream at ws://127.0.0.1:27022/api/v1/events. It is enabled by default but needs the REST API to be enabled, and uses the same tokens.

Authenticate​

The first message must be:

{ "type": "auth", "token": "sac_..." }

A client can also send the token in an Authorization: Bearer header when it connects. After a successful login the server replies with auth.ok.

Messages from the client​

TypeDescription
authLog in with a token. Must be first.
subscribeChoose which events to receive.
commandRun a command as the token's group.
pingKeep the connection alive.

Events​

Each event is only sent to connections whose group has the matching permission.

EventPermission
player.joined, player.left, player.kicked, player.group_changedserveradmincore.players
sanction.muted, sanction.unmutedserveradmincore.players
sanction.banned, sanction.unbannedserveradmincore.ban
chatserveradmincore.players
whitelist.changedserveradmincore.players
pending_action.changedserveradmincore.players
autokick.warning, autokick.cancelledserveradmincore.players
adminlog, command.executedserveradmincore.logs

IP addresses are removed from every event unless the group has serveradmincore.info.ip.

Try it in a browser console​

const ws = new WebSocket("ws://127.0.0.1:27022/api/v1/events");
ws.onopen = () => ws.send(JSON.stringify({ type: "auth", token: "sac_..." }));
ws.onmessage = (e) => console.log(e.data);