Slide 20
Slide 20 text
Trigger and bind to events in the
client
$ ->
dispatcher = new WebSocketRails('localhost:3000/websocket')
dispatcher.on_open = (data) ->
console.log "Connection has been established: #{data}"
$('#rsvp_yes').bind 'click', (message) =>
dispatcher.trigger 'rsvp.new', true
dispatcher.bind 'new_rsvp', (rsvp_yes_count) =>
$('#rsvp_yes_count').html rsvp_yes_count