Get Data Notifacation em tempo real use Ajax Good

$(window).load(realTime);
    function realTime() {
        $.ajax({
            type:'post',
            url:'/chat/get',
            data:{
                '_token':$('input[name=_token]').val(),
            },
            success: function (data) {
                $('#message').replaceWith(' <ul class="media-list" id="message"></ul>');
                for (var i=0; i < data.length; i++){
                    $('#message').append(' <li class="media"><div class="media-body"><div class="media"><div class="media-body">'+data[i].message+'<br/><small class="text-muted">'+data[i].from_name+'|'+ data[i].created_at+'</small><hr/></div></div></div></li>')
                }
             setTimeout(realTime, 2000);
            },
        });

    }
}
Xanthous Xenomorph