ChatKC is a protocol that originated from MattKC's website here and reverse engineered by Breadpudding and janKonku on January 16th, 2023. After playing around with the protocol for hours, MattKC found us hanging out and decided to tweak the protocol a bit to make things easier for us to work with. This document describes the protocol that was created as a result.
In order to connect to a ChatKC server, you must establish a secure WebSocket connection to TCP port 2002 and send the "hello" event to the server. Once the server sends the initial burst of "message" events followed by "join" events, bidirectional communication can take place.
All events sent to and received from the server are JSON objects containing the type
and data
attributes. The type
attribute will always be a string that describes the information found in the data
attribute.
In addition to those two fields, events sent to the server are required to have the auth
and token
attributes. In the reference implementation of the server, auth
is always set to the string "google" and token
is set to your OAuth2 token.
This event means that the server has acknowledged the last message you sent. The data
for this type is an object with the message
attribute set to the content of your last message.
Example:
{
"type": "accepted",
"data": {
"message": "Hello world!"
}
}
This event informs the client of their current authentication level. The data
for this type is an object with the value
attribute set to a number corresponding to your current authentication level.
Example:
{
"type": "authlevel",
"data": {
"value": 0
}
}
This event informs the client of a new message. The data
for this type is an object with the following attributes:
Name | Type | Description |
---|---|---|
auth |
number |
Unknown |
author |
string |
The name of the user who created the message |
author_color |
string |
The hexadecimal color code of the user's preferred name color |
author_id |
number |
The identifier of the message author |
author_level |
number |
The authentication level of the message author |
donate_value |
string |
The donation amount given in USD (or an empty string for no donation) |
id |
number |
The identifier of the message itself |
message |
string |
The contents of the message |
reply |
number |
The identifier of the message being replied to (0 if none) |
time |
number |
The timestamp of when the message was created in milliseconds since the Unix epoch |
Example:
{
"type": "chat",
"data": {
"auth": 0,
"author": "Breadpudding",
"author_color": "B3DCF5",
"author_id": 2268,
"author_level": 0,
"donate_value": "2.00",
"id": 15225,
"message": "Hello world!",
"reply": 0,
"time": 1674090083882
}
}
This event informs the client that the list of message identifiers given have been deleted from the server. The data
for this type is an object with the messages
attribute which is an array of message IDs.
Example:
{
"type": "delete",
"data": {
"messages": [
15221,
15222,
15223,
15224,
15225
]
}
}
This event informs the client of the user's current configuration. The data
for this type is an object with the color
and name
attributes, where the color
attribute is the user's name color in hexadecimal and the name
attribute is the current username.
Example:
{
"type": "getuserconf",
"data": {
"color": "B3DCF5",
"name": "Breadpudding"
}
}
This event informs the client that a member has joined the chat. The data
for this type is an object with the name
attribute set to the member's name.
Example:
{
"type": "join",
"data": {
"name": "Breadpudding"
}
}
This event informs the client that a member has left the chat. The data
for this type is an object with the name
attribute set to the member's name.
Example:
{
"type": "part",
"data": {
"name": "Breadpudding"
}
}
This event contains a message from the server to the client. This message is only visible to the client that received it and is typically used for error messages. The data
for this type is an object with the message
attribute.
Example:
{
"type": "servermsg",
"data": {
"message": "Available commands: commands, forum, forums, geoguessr, help, info, insta, instagram, time, timer, twitter, website, youtube, yt"
}
}
This event informs the client of their current status. The data
for this type is an object with the status
attribute set to the current status.
Example:
{
"type": "status",
"data": {
"status": "authenticated"
}
}
Status Code |
---|
authenticated |
banned |
nameexists |
nameinvalid |
namelength |
nametimeout |
rename |
setuserconf |
unauthenticated |
This event is used to ask the server for the client's current configuration. There is no data
field for this event.
Example:
{
"type": "getuserconf",
"auth": "google",
"token": "..."
}
This event is used to introduce the client to the server. The data
for this type is an object with the last_message
attribute set to -1
. Currently, we do not know why this data is sent.
Example:
{
"type": "hello",
"data": {
"last_message": -1
},
"auth": "google",
"token": "..."
}
This event is used to send a message to the server. The data
for this type is an object with the following attributes:
Name | Type | Description |
---|---|---|
reply |
number |
The ID of the message that this message is a reply of (0 for none) |
text |
string |
The content of the message being sent |
Example:
{
"type": "message",
"data": {
"text": "Hello world!",
"reply": 0
},
"auth": "google",
"token": "..."
}
This event is used to donate money to the owner of the server.
Example:
{
"type": "paypal",
"data": {
// A lot of this isn't safe to put in documentation
},
"auth": "google",
"token": "..."
}
This event is used to store the client's current configuration on the server. The data
for this type is an object containing the color
and name
attributes.
Example:
{
"type": "setuserconf",
"data": {
"name": "Breadpudding",
"color": "B3DCF5"
},
"auth": "google",
"token": "..."
}
This event is used to request a status update from the server. The data
for this type is an empty object.
Example:
{
"type": "status",
"data": {},
"auth": "google",
"token": "..."
}
Commands are actions performed by users using messages prefixed with an exclamation point.
Usage: !ban <username>
Summary: Bans a user from the chat
Minimum Authentication Level: Unknown
Aliases: commands
Usage: !help
Summary: Lists all of the commands that the user has access to
Minimum Authentication Level: 0
Usage: !info
Summary: Displays information about the server
Minimum Authentication Level: 0
Usage: !ipban <address>
Summary: Blocks a specific IP address from sending messages
Minimum Authentication Level: Unknown
Usage: !mod <username>
Summary: Promotes a user to a moderator
Minimum Authentication Level: Unknown
Usage: !rm <message id>
Summary: Deletes a message from the chat
Minimum Authentication Level: Unknown
Usage: !time
Summary: Displays the current time on the server
Minimum Authentication Level: 0
Usage: !timer <start/check/stop> <name>
Summary: Creates, checks, or deletes a timer on the server
Minimum Authentication Level: 0
Usage: !unban <username>
Summary: Reverts an existing ban on a user
Minimum Authentication Level: Unknown
Usage: !unmod <username>
Summary: Demotes a user to an unprivileged member
Minimum Authentication Level: Unknown
TODO
The emoji system is still very unknown, but it seems that they are pulled from an array or table.
https://stream.mattkc.com/chat/emotes/
TODO
TODO
The following is a list of the currently known authentication levels:
Level | Meaning |
---|---|
0 |
An unprivileged member of the server |
50 |
Server moderator |
100 |
The owner of the server |
Level | !ban |
!ipban |
!mod |
!rm |
!unban |
!unmod |
---|---|---|---|---|---|---|
0 |
No | No | No | No | No | No |
50 |
Unknown | Unknown | Unknown | Yes | Unknown | Unknown |
100 |
Yes | Yes | Yes | Yes | Yes | Yes |