     @author = @komp =>
       @committer_name or @committer_email
 
+    @build_channel = VM.pusher.subscribe(@pusherChannel())
+    @build_channel.bind('pusher:subscription_error', (status) -> notifyError status)
+
+    @build_channel.bind('newAction', (json) => newAction json)
+    @build_channel.bind('updateAction', (json) => updateAction json)
+    @build_channel.bind('appendAction', (json) => @appendAction json)
+
+  newAction: (json) =>
+    fillArray(@steps, json.steps, Step)
+    fillArray(@steps()[json.step].actions, json.index, ActionLog)
+
+
+  appendAction: (json) =>
+    fillArray(@steps, json.steps, Step)
+    fillArray(@steps()[json.step].actions(), json.index, ActionLog)
+
+    @steps[json.step].actions()[json.action].push(json.out)
+
   # TODO: CSRF protection
   retry_build: (data, event) =>
     $.ajax(

    $.getJSON "/api/v1/project/#{project_name}/#{build_num}", (data) =>
      start_time = Date.now()
      @build(new Build data)
      @build_channel = @pusher.subscribe(@build().pusherChannelName())
      @build_channel.bind('pusher:subscription_error', (status) -> notifyError status)

      window.time_taken_build = Date.now() - start_time


    textVal t, loading
)

#adds new instances of cls to the array until index X is valid
fillArray = (arr, index, cls) ->
  num_insert = arr.length - index - 1
  for i in [0..(num_insert - 1)]
    arr.push(new cls({}))

window.fillArray = fillArray

# Make the buttons disabled when clicked
$.ajaxSetup
