summaryrefslogblamecommitdiff
path: root/proto.txt
blob: 9ec09db950147f8b1632d8fb97cb70fa3d85dcc4 (plain) (tree)


























































































































































































                                                                                        
baitv-daemon Protocol Specification
===================================
The baitv-daemon protocol is a simple command-based, single-line, plain-text
chat protocol. It works with WebSockets over the port 6969 by default
and optionally over SSL/TLS.

Commands are separated in client commands (commands sent by the client to the
server), server commands (commands sent by the server to the client) and
server responses (response commands sent by the server to reply to a client
command).

Commands support arguments and they are separated by a colon (:) character.

The maximum length of a command is 128 characters.


Client commands
---------------
Command
    MSG  
Arguments
    Color.......Arbitrary number to identify the message color.
    Message.....The message contents.
Explanation
    Sends a message to the chat room.
Example
    MSG:2:Hello how are you everybody!

Command
    LOGIN
Arguments
    Password....Admin password string.
Explanation
    Logs in as an administrator in order to run admin commands and information.
Example
    LOGIN:mypassword

Command
    LOGOUT
Explanation
    Closes the administrator session.
Example:
    LOGOUT

Command
    NOTICE
Arguments
    Show Name...Indicates if streamer's name should be shown (0 or 1).
    Message.....The message contents.
Explanation
    Shows a special message which special emphasis. Only can be sent by logged in users.
Example
    NOTICE:1:Please be warned!

Command
    KICK
Arguments
    User ID.....User ID to kick.
Explanation
    Kicks a specified user. Only can be sent by logged in users.
Example
    KICK:4fc2a

Command
    BAN
Arguments
    User ID.....User ID to ban.
Explanation
    Bans a specified user permanently. Only can be sent by logged in users.
Example
    BAN:4fc2a

Command
    SETTITLE
Arguments
    Title.......Stream title to set
Explanation
    Sets a new stream title. Only can be sent by logged in users.
Example
    SETTITLE:Testing stream

Command
    SETSOURCE
Arguments
    New source...Source string to set
Explanation
    Sets a new source. Only can be sent by logged in users.
Example
    SOURCE:HLS



Server Commands
---------------
Command
    WELCOME
Arguments
    Version.....The current version of the server
Explanation
    This is the first command sent by the server when a connection is made in
    order to signal to the client that it is free to start sending commands.
Example
    WELCOME:v0.0.1

Command
    COUNT
Arguments
    Count       Number of users online
Explanation
    This informs the client of the total number of users in the chat room.
    It is sent when the user is connected or when any client enters or leaves
    the room.
Example
    COUNT:13

Command
    MSG
Arguments
    Color       Number that identifies the message color.
    Message     Contents of the message.
Explanation
    Sent when someone has said something in the chat room.
Example:
    MSG:1:We're fine, what about you?

Command
    FMSG
Arguments
    ID          Short hash of the sender of the message.
    Color       Number that identifies the message color.
    Message     Contents of the message.
Explanation
    Same as MSG but with extended information about the sender.
    Sent only when the peer has admin privileges (LOGIN).
Example
    FMSG:adbibi:0:Are you there?

Command
    KICKED
Explanation
    Sent when a user in the chatroom has been kicked.
Example
    KICKED

Command
    NOTICE
Arguments
    Author      Author of the notice.
    Message     Contents of the message.
Explanation
    Sent when there's a new notice.
Example
    NOTICE:Streamer:Stream will start in 1 minute.

Command
    TITLE
Arguments
    Title       New title.
Explanation
    Sent when the stream title has changed.
Example
    TITLE:Stream test

Command
    SOURCE
Arguments
    Source      New title.
    Timestamp   Timestamp of the source change.
Explanation
    Sent when the stream source has changed.
Example
    SOURCE:HLS:1583973816


Server Responses
----------------
Command         Reply to    Explanation

WHAT            *           Command unrecognized.
INVALID         *           The command is malformed.
BADPASS         LOGIN       Wrong password.
LOGIN_OK        LOGIN       Login successful.
LOGOUT_OK       LOGOUT      Logout successful.
KICK_OK         KICK        User kicked.
KICK_NO         KICK        No one was kicked.
FORBIDDEN       *           Not enough privileges.
FUCKOFF         *           Command too long.