Skip to content

Server Client Message Codes

Max Hutz edited this page Oct 6, 2023 · 4 revisions

Server/Client Message Codes

When the ChatJS server and client interact with each other, they send with their message certain codes.

Server to Client Codes

Code Op Type Explanation
0 This message deals with establishing new connections and signing in, or signing up.
0 0 Success: A connection has been established.
0 1 This message deals with confirmation codes or registration errors.
0 1 0 Success: The confirmation code has been sent.
0 1 1 Error: An account already registered the email.
0 1 2 Error: An account already registered the username.
0 1 3 Error: The password is not strong enough.
0 2 This message deals with responses to a registration confirmation code.
0 2 0 Success: The account was been successfully created.
0 2 1 Error: Incorrect code inputted.
0 2 2 Error: Confirmation code has expired.
0 401 Error: The user has given an incorrect password.
0 403 Error: The user has an invalid session ID.
0 404 Error: The user has given an incorrect username.
1 This message deals with resuming a discontinued user session.
1 0 Sent all messages to the user, but not images.
4 This message deals with social interactions, like friend requests, or notifications.
4 0 Returned main social data about user.
4 1 A user was sent a new friend request.
4 2 Success: User's friend request accepted.
4 3 Failure: User's friend request rejected.
4 4 Success: User's friend request cancelled.
4 5 Success: The user's friend request that was submitted was recognized.
4 6 Notification for a profile edit request.
4 7 User removed from a friend group, or DM.
4 8 User has been sent a message by a friend.
5 Success: The user has sent a message to the server.
10 Success: The user's ping has been recognized. A.k.a a 'pong'.

Client to Server Codes

Code Op Explanation
0 This message deals with establishing new connections and signing in, or signing up.
0 0 The user is requesting to log in.
0 1 The user is requesting to create an account.
0 2 The user is submitting a confirmation code.
1 This message deals with confirmation codes or registration errors.
1 0 The user is requesting everything, except the images of the page they are on.
2 This message deals with logging out from a session.
2 0 The user requests to log out from every session with their account.
2 1 The user requests only to log out from the session they are in.
3 This message deals with accessing DMs and other's messages.
3 0 The user requests all messages between them and a specific user.
3 1 The user requests to open a new DM with a user.
3 2 The user requests to close a current DM with a user.
3 3 THe user is sending a read receipt, to tell other clients that they have read the message.
4 This message deals with requesting social information.
4 0
4 1 The user is sending a friend request.
4 2 The user is accepting a friend request sent to them.
4 3 The user is rejecting a friend request sent to them.
4 4 The user is canceling a friend request they sent.
4 5 The user is requesting to change their profile.
4 6 The user is requesting to remove a friend.
4 7 The user is requesting a list of their friends.
4 8 The user is asking to create a group DM, with multiple users.
4 9 The user is asking to remove themselves from a group DM.
5 This message deals with creating and manipulating messages by the user.
5 0 The user is acknowledging that they have received a message.
5 1 The user wants to delete a message.
5 2 The user wants to edit a message they sent.
10 The user checks their access to the server with a 'ping'.
Clone this wiki locally