VaughnSoft Developer Api - v1.0 Beta

Welcome to the early state of the VaughnSoft Developer Api. Below you will see code examples and REST API endpoints for various Vaughn Live and Breakers.TV data.

Organization isn't a priorty at this stage. Don't judge too harshly.
Video Ingest Servers
https://api.vaughnsoft.net/v1/ingest_servers
Server Api (sApi) Servers
https://api.vaughnsoft.net/v1/sapi_servers
REST Stream API (JSON)
https://api.vaughnsoft.net/v1/stream/vl/mark


Example response:
{"status":200,"chat_server":"chat-ws-1x03.vaughnsoft.net","chat_server_irc":"131.153.7.100","live":true,"viewers":"80","pageviews":"200443","followers":"1399","webrtc":false,"lastlive":"1686951586","lastoffair":"1686867084","is_mature":false,"status_msg":"SGF2ZSB5b3Ugc2VlbiB0aGUgbmV3IGNoYW5uZWwgcGFnZT8","about_msg":"V2lzaCBMaXN0Cmh0dHBzOiAjMDQ3ICAjMDQ3IHd3dy5hbWF6b24uY29tICMwNDcgaHogIzA0NyB3aXNobGlzdCAjMDQ3IGxzICMwNDcgNTFST0xCUzg3NTU1CgpTZW5kIEFtYXpvbiBHaWZ0Y2FyZCB0byBnaWZ0Y2FyZCAjMDY0IHZhdWdobnNvZnQuY29tCmh0dHBzOiAjMDQ3ICAjMDQ3IHNtaWxlLmFtYXpvbi5jb20gIzA0NyBBbWF6b24gIzA0NSBlR2lmdCAjMDQ1IENhcmQgIzA0NSBMb2dvICMwNDcgZHAgIzA0NyBCMDdQQ01XVFNHICMwNDcgCk5vdGU6IEFtYXpvbiBHaWZ0Y2FyZCBkb2VzIG5vdCBzaGFyZSBhbnkgcGVyc29uYWwgaW5mbyB3aXRoIG1lCgpTdHJlYW0gVGlwCmh0dHBzOiAjMDQ3ICAjMDQ3IHN0cmVhbWVsZW1lbnRzLmNvbSAjMDQ3IG1hcmsgIzA0NSA0MDI0ICMwNDcgdGlwCgooTm8gcmVmdW5kcyBhdmFpbGFibGUp","url":"https:\/\/vaughn.live\/mark","profile_img":"https:\/\/cdn.vaughnsoft.net\/profile\/1686965399\/mark.jpg","profile_url":"https:\/\/myvaughn.com\/mark"}
                    
// chat_server: Chat server specific to this stream. Connect to it using WebSocket's
// chat_server_irc: Use this to connect to the stream chat via IRC (VIP Gold account required)
// live: Tells if the stream is currently live or not
// viewers: How many are watching the stream right now
// pageviews: Overall total pageviews the stream has received
// followers: How many followers the stream has
// webrtc: If this stream requires a WebRTC player to view
// lastlive: EPOCH timestamp of when stream last went live
// lastoffair: EPOCH timestamp of when stream last went off air
// is_mature: If stream is set for mature audiences only
// status_msg: Base64 encoded stream status message string
// about_msg: Base64 encoded about section string
// url: Address to the stream
// profile_img: Stream's profile image
// profile_url (deprecated): Link to stream's profile page. This has been deprecated as the profile page has been discontinued.
                    
Server Api (sApi) Example
let LiveServerApi = () => {
    if ("WebSocket" in window) {
        var vs_serverapi_socket = new WebSocket("wss://sapi-ws-1x01.vaughnsoft.net/mvn");
        vs_serverapi_socket.onopen = function() {
            console.log("Connected");
            // Stream name structure:
            // Prefix: #
            // Vaughn Live = vl
            // Breakers.TV = btv
            // Delimiter: -
            // If stream URL is vaughn.live/mark then stream name will be #vl-mark
            // If stream URL is breakers.tv/mark then stream name will be #btv-mark
            //
            // All commands sent must end with \n\0
            // That is a remnant left over from the old Flash days. A future
            // iteration of the sApi will deprecate that.
            //
            vs_serverapi_socket.send("MVN LOAD3 #vl-mark guest guest\n\0"); // no need to authenticate, specify stream and continue as guest
        };
        vs_serverapi_socket.onmessage = function (vs_e) { 
            var vs_msg = vs_e.data.toString();
            vs_msg = vs_msg.replace("\n", "");
            vs_msg = vs_msg.replace("\0", "");
            if(vs_msg.startsWith("ACK3 ")) {
                // request sapi data for channel
                //
                // Note the channel name here doesn't need to match the initial
                // connection string channel. You can request sApi data for any
                // stream on a single sApi connection.
                //
                vs_serverapi_socket.send("MVN STREAM3 #vl-tech_corner\n\0"); 
            } else if(vs_msg.startsWith("STREAM3 ")) {
                // You should receive a response like this:
                // STREAM3 #vl-mark;1;1;-1;-1;0;0;0;1;-1;0
                //
                // There are two reasons why it's structured this way
                // 1. Less bytes to send
                // 2. To be as confusing as possible to anyone snooping around
                //
                // Things have changed since then. We no longer need to be
                // concerned about byte size and we're building out a public API
                //
                // A future iteration of the sApi will have human readable keys
                // and values.
                //
                //
                // STREAM3 = prefix command
                // Next is delimited by a semicolon. For simplicity, we'll list
                // the delimited here as if it were already an array
                //
                // [0] channel you want sApi data for
                // [1] Clients connected to the stream on this sApi server (deprecated)
                // [2] Live viewers for the stream
                // [3] 
                // [4] 
                // [5] 
                // [6] If stream is live, returns 1
                // [7] HLS playback supported. Not all streams qualify for HLS playback due to encoder settings
                // [8] If stream is transcoded (deprecated)
                // [9]  
                // [10] Stream status -- 0 = good but off air, 1 = good but live, 2 = banned
                // 
                let splt = vs_msg.split(" ")[1].split(";");
                if(splt.length > 9) {
                    let stream_name = splt[0];
                    let live_viewers = splt[2];
                    let is_live = splt[6];
                    let stream_status = splt[10];
                    //
                    if(is_live == 1)
                        is_live = "Yes";
                    else
                        is_live = "No";
                    //
                    if(stream_status == 2)
                        stream_status = "Yes";
                    else
                        stream_status = "No";
                    //
                    console.log("---");
                    console.log("Stream Name: " + stream_name);
                    console.log("Live Viewers: " + live_viewers);
                    console.log("Is " + stream_name + " Live?: " + is_live);
                    console.log("Is " + stream_name + " Banned?: " + stream_status);
                }
            } else if(vs_msg == "PING") {
                vs_serverapi_socket.send("PONG");
            }
        };
        vs_serverapi_socket.onclose = function() {
            console.log("Lost Connection"); 
            setTimeout(function() {
                LiveServerApi();
            }, 2000);
        };
    }
};
LiveServerApi();
Poll for fresh Server Api (sApi) data

You don't have to initiate a new connection each time you want fresh data. You can throw the send command in a timer (setInterval for this example) and request fresh data every five seconds (5000ms) but no faster than two seconds (2000ms).
setInterval(function() {
    vs_serverapi_socket.send("MVN STREAM3 #vl-tech_corner\n\0");
}, 5000);
Follower Notifications Example
let FollowerAlerts = () => {
    if ("WebSocket" in window) {
        var vs_follower_socket = new WebSocket("wss://chat-ws-1x01.vaughnsoft.net/mvn");
        vs_follower_socket.onopen = function() {
            console.log("Connected");
            vs_follower_socket.send("MVN AUTH guest guest"); // no need to authenticate, continue as guest
        };
        vs_follower_socket.onmessage = function (vs_e) { 
            var vs_msg = vs_e.data.toString();
            vs_msg = vs_msg.replace("\n", "");
            vs_msg = vs_msg.replace("\0", "");
            if(vs_msg.startsWith("ACK ")) {
                // Stream name structure:
                // Prefix: #
                // Vaughn Live = vl
                // Breakers.TV = btv
                // Delimiter: -
                // If stream URL is vaughn.live/mark then stream name will be #vl-mark
                // If stream URL is breakers.tv/mark then stream name will be #btv-mark
                vs_follower_socket.send("JOIN #vl-mark"); // must join channel you want Follower notifications from
            } else if(vs_msg.startsWith("MVN FOLLOW ")) {
                let splt = vs_msg.split(" ");
                if(splt.length > 2) {
                    let follower_username = splt[2]; // Follower username
                    console.log(follower_username + " Followed!");
                }
            } else if(vs_msg == "PING") {
                vs_follower_socket.send("PONG");
            }
        };
        vs_follower_socket.onclose = function() {
            console.log("Lost Connection"); 
            setTimeout(function() {
                FollowerAlerts();
            }, 2000);
        };
    }
};
Need something specific? Send an email to contact@vaughnsoft.com