Requests

All communications with the server must be in JSON.

Responses of client requests will always contain the following fields:

Field Value Description
ok boolean Successful request
error* string Error message (Only if ok is false)
id number ID of the request provided by the client (defaults to 1)
uuid string UUID of the client session (random if not authenticated)

* Not always included

Connection

Connection is possible with WebSocket from the endpoint wss://net.ale32bit.me/

Events

The events are messages sent by the server automatically and do not directly require any request.

Currently the events are:

Ping ping

This event is sent every 10 seconds.

Field Type Description
type string ping
time number Unix Epoch in milliseconds

Message message

Message events can only be received by opening channels.

Field Type Description
type string message
channel string / number Channel name
message any Message sent by a client
meta object Contains metadata

Message metadata

The message metadata contains additional information about the message, any client can add any value to it.

The server always sends these metadata by default (and overrides client's):

Field Type Description
uuid string UUID of the sender
channel string / number Channel name
time number Unix epoch of the date the message was sent
guest boolean If the sender was authenticated

Message of the day motd

This event is sent upon connection to the server

Field Type Description
type string motd
motd string Any message the

Authentication

It's possible to get unique and persistent UUIDs by authenticating with a token.

Request format:

{
    "type": "auth",
    "token": "MyToken",
    "id": 4
}

Opening a channel

Opening channels allows the receiving of messages from other clients.

The Wildcard to listen to all channels is *.

Request format:

{
    "type": "open",
    "channel": "channel_name",
    "id": 3
}

Closing a channel

Closing channels will stop getting messages from other clients.

Request format:

{
    "type": "close",
    "channel": "channel_name",
    "id": 2
}

Sending a message

The main point of this server is to transmit messages remotely.

Request format:

{
    "type": "send",
    "channel": "channel_name",
    "message": "Any type",
    "meta": {} // This is optional
    "id": 1
}