index.js 519 Bytes
$(function() {
    $("a.badge").tooltip();

    // connect to server like normal
    // FIXME: how to get the right address
    var dispatcher = new WebSocketRails('localhost:3000/websocket');

    // subscribe to the channel
    var channel = dispatcher.subscribe('requests_update');

    // bind to a channel event
    channel.bind('update', function(data) {
        alert("Um vídeo que estava em processamento está disponível. Sua página será atualizada automaticamente.")
        location.reload();
    });
});