WebSockets and TCP Sockets

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 via WebSocket from the endpoint wss://soqet.alexdevs.pw/ and from the TCP socket soqet.alexdevs.pw:25555

Requests

Requests can optionally have the id field to identify requests, this is to help clients manage better the server responses.

Authentication

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

Field Value Description
type "token" Required
token string Token for authentication

Opening a channel

Opening channels allows the receiving of messages from other clients.

The Wildcard to listen to all channels is *.

Field Value Description
type "open" Required
channel string | number Channel to open

Closing a channel

Closing channels will stop getting messages from other clients.

Field Value Description
type "close" Required
channel stirng | number Channel to close

Sending a message

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

Field Value Description
type "send" Required
channel string | number Channel to send to
message any The message itself, can be anything.
meta object The metadata object. See metadata for default values.

Polling

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)
uuid string UUID of the client session (random if not authenticated)

* Not always included

Connection

Polling connection is possible via the GET URL https://soqet.alexdevs.pw/api/connect?token=[optional token here].

Response is in application/json type and contains the session token used for requests in the token field.

Field motd is also supplied upon connection.

Once connected you need to request /api/update at least once every 60 seconds to keep the session token alive!

REST URLs

token must always be supplied for the following requests!

POST /api/update

Fetch latest updates from the queue

This API should be requested often

Fields

Field Type Description
queue array The queue contains all events that happened since the last update request.
See events for a list of possible values.

POST /api/send

Transmit a message to a channel

Fields

Field Type Description
channel string | number The channel name.
message any The message itself, can be anything.
meta object The metadata object. See metadata for default values.

POST /api/open

Open a channel to listen to

Fields

Field Type Description
channel string | number The channel name

POST /api/close

Close a channel

Fields

Field Type Description
channel string | number The channel name

Events

The events are messages sent by the server automatically and do not directly require any request (unless client is using polling).

Currently the events are:

Ping ping

This event is sent every 10 seconds.

Not available in polling clients.

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 Inspiring quotes to help the developer and the user get over problems and easily achieve life goals.