 
   handleEvents: ->
     messageCallbacks =
-      sync: @onSync
-      build: @onBuild
-      fetch: @onFetch
-      change: @onChange
-      rescue: @onRescue
+      sync: @onRecievedSync
+      build: @onRecievedBuild
+      fetch: @onRecievedFetch
+      change: @onRecievedChange
+      rescue: @onRecievedRescue
 
     @websocket.onopen = (event) =>
       @send {command: 'build'}

  # ------------------

  sync: ->
    fs.makeTreeSync(@physicalRoot) unless fs.existsSync(@physicalRoot)
    @tree.getPathsToRemove().forEach (path) -> shell.moveItemToTrash(path)
    @tree.getPathsToSync().then (paths) => @fetch(paths)

  fetch: (paths) ->
    pathsToFetch = paths.map (path) => @convert.localToRemote(path)

    decoded = new Buffer(contents, 'base64').toString('utf8')
    fs.writeFile(localPath, decoded)

  onRecievedRescue: ({message, backtrace}) ->
    console.log 'RESCUE:', message, backtrace

  # ------------------
