Ready event

Before sending events and listening to channels, the client must wait for the ready event sent from PushJS self.

Listening for the ready event

This snippet will attach the `ready` function as callback. Once the client is connected it will call this function.

                
<script>

    window.onload = function() {

        // initialize PushJS with a config object
        // the config object can contain the properties: readyListener, host and port
        PushJS.init({
            readyListener: ready
        });
    };

    function ready() {
        console.log('Hello! Welcome to PushJS');
    }

</script>