Skip to content

Instantly share code, notes, and snippets.

@pystub
Last active August 8, 2021 19:23
Show Gist options
  • Save pystub/08b2d8d0830f89badfbb0bbc75ef4957 to your computer and use it in GitHub Desktop.
Save pystub/08b2d8d0830f89badfbb0bbc75ef4957 to your computer and use it in GitHub Desktop.
IWBTS Chat """API"""

websocket connetion to wss:/ws/ everything is sent as serialized json objects

from server to client

initial dump of all the users' details

{"t":"Au":"users":{$all_users_serialized},"groups":{$all_groups_serialized}}

this should be the first thing that's received upon connecting

message

{"t":"m","i":$message_id_number,"ts":"2006-01-02T15:04:05.999Z07:00","uid":$author_id_number,"c":"$message_contents"}

error

{"t":"error","m":"$error_message"}

info

{"t":"info","m":"$info_message"}

user connecting

{"t":"+u","u":{$all_user_fields_serialized}}

a user has connected

user connection changing

{"t":"*u","u":{$all_user_fields_serialized}}

user has been modified in some way and should be updated (sends everything, not just the change)

user connection ended

{"t":"-u","uid":$user_id_number}

user has went away and has no messages in history, all related information can be released

current connection's user has changed

{"t":"su","id":$user_id_number}

connection is from now on using the specified user

from client to server

message

{"t":"m","c":"$message_text"}

posts a message, if current user can and post rate is not exceeded. might queue "t":"m" on success

sign in

{"t":"sign in","name":"$user_name","pass":"$user_password"}

changes current user. might queue "t":"su" on succcess or "t":"error" on failure

sign up

{"t":"sign up","name":"$user_name","pass0":"$user_password","pass1":"$user_password"}

creates new user only. might queue "t":"info" on success or "t":"error" on failure

password change

{"t":"chpass","c-pass":"$user_password","pass0":"$new_user_password","pass1":"$new_user_password"}

changes current user password, if it's possible. might queue "t":"info" on success or "t":"error" on failure

style change

{"t":"style", }

modifies current user's styles that are specified. migth queue "t":"user style change" on if stars align or "t":"error" on failure

moving users between groups

{"t":"move","group":"$group_name","u":$user_id_number}

if current user has the power, moves the specified user to another group. might queue "t":"error" on failure or "t":"*u" on success (probably, can't make it out just from hub.go)

deleting posts

{"t":"del","msg-id":$post_id_number}

removes a post. might queue "t":"del" on success

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment