send_server_message(message) {
        // Tries to send the message if the readystate is open //
        if(this.socket.readyState === WebSocket.OPEN)
            this.socket.send(JSON.stringify(message))
        // If this code runs too fast, you need to handle it beating the connection //
        else if (this.socket.readyState === WebSocket.CONNECTING) {
            this.socket.addEventListener("open", () => {
                this.send_server_message(message)
            })
        }
    }
/**
     * This takes the message, opens a connection with the
     * server and sends the message along. This later is 
     * hooked by the .onmessage function defined in `open_connection`
     * which handles the callback.
     * 
     * @param {JSON} message 
     */
This takes the message, opens a connection with the
server and sends the message along. This later is
hooked by the .onmessage function defined in `open_connection`
which handles the callback.

@param {JSON} message
This takes the message opens a connection with the server and sends the message along . This later is hooked by the . onmessage function defined in ` open_connection ` which handles the callback . @param { JSON } message
send_server_message(message) {
        if(this.socket.readyState === WebSocket.OPEN)
            this.socket.send(JSON.stringify(message))
        else if (this.socket.readyState === WebSocket.CONNECTING) {
            this.socket.addEventListener("open", () => {
                this.send_server_message(message)
            })
        }
    }
send_server_message ( message ) { if ( this . socket . readyState === WebSocket . OPEN ) this . socket . send ( JSON . stringify ( message ) ) else if ( this . socket . readyState === WebSocket . CONNECTING ) { this . socket . addEventListener ( "open" , ( ) => { this . send_server_message ( message ) } ) } }
This takes the message, opens a connection with the
 server and sends the message along.
This takes the message opens a connection with the server and sends the message along .
// Tries to send the message if the readystate is open // // If this code runs too fast, you need to handle it beating the connection //