Table of Contents
Types
This is a list of all data types that appear in Sock Chat packet fields.
bool
A value that indicates a true or a false state.
0
represents false and anything non-0
represents true, please stick to 1
for representing true though.
int
Any integer ranging from -9007199254740991
to 9007199254740991
, Number.MAX_SAFE_INTEGER
and Number.MIN_SAFE_INTEGER
in JavaScript.
string
Any UTF-8 codepoint, except \t
which is used to separate packets.
collection
A set of string values, separated by \f
.
timestamp
Extends int, contains the current UNIX timestamp as seconds since January 1st, 1970 0:00:00 UTC.
user name
A string containing a user’s name.
If the user currently has an AFK tag set through the /afk
, it is prefixed by <AFK>_
. The AFK
text can be replaced by any text supplied to the /afk
command as an argument, the original PHP Sock Chat and SharpChat force this text to uppercase and limit it to 5 unicode grapheme clusters.
If prefixed by a ~
, it is not the user’s actual name but a nick name.
channel name
A string containing only alphanumeric characters (any case), -
or _
.
colour
Any valid value for the CSS color
property. Further documentation can be found on MDN.
message flags
Message flags alter how a message should be displayed to the client, these are all bool values. The parts are as follows:
- Username should appear using a bold font.
- Username should appear using a cursive font.
- Username should appear underlined.
- A colon
:
should be displayed between the username and the message. - The message was sent privately, directly to the current user.
As an example, the most common message flagset is 10010
. This indicates a bold username with a colon separator.
user perms
User permissions are a set of flags separated by either the form feed character (\f
/ 0x0C
) or a space (’ ’ / 0x20
). The reason there are two options is due to a past mixup that we now have to live with. Which of the methods is used remains consistent per server however, so the result of a test can be cached.
Note that this string MAY be empty if sent by the bot user (-1
).
Type | Description |
---|---|
int | Rank of the user. Used to determine what channels a user can access or what other users the user can moderate. |
bool | Indicates whether the user the ability kick/ban/unban others. |
bool | Indicates whether the user can access the logs. This should always be 0 , unless the client has a dedicated log view that can be accessed without connecting to the chat server. |
bool | Indicates whether the user can set an alternate display name. |
int | Indicates whether the user can create channel. If 0 the user cannot create channels, if 1 the user can create channels but they are to disappear when all users have left it and if 2 the user can create channels that permanently stay in the channel assortment. |