     path = @convert.remoteToLocal(path)
     @treeView()?.selectEntryForPath(path)
 
-  onFetch: ({path, attributes, contents}) =>
+  onRecievedFetch: ({path, attributes, contents}) =>
     # TODO: preserve full stats
     localPath = @convert.remoteToLocal(path)
     dirname = _path.dirname(localPath)

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

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

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

  # onmessage callbacks
  # -------------------

  onRecievedBuild: ({entries, root}) =>
    @root = @convert.remoteToLocal(root)
    @tree.update(entries)
    atom.project.addPath(@root)
    # TODO: persist title change, maybe use custom-title package
    document.title = "Learn IDE - #{@convert.localToRemote(@root).substr(1)}"
    @sync()
    @treeView()?.updateRoots()

  onRecievedSync: ({entries}) =>
    @tree.addDigests(entries)
    fs.makeTreeSync(@physicalRoot) unless fs.existsSync(@physicalRoot)
    @tree.getPathsToRemove().forEach (path) -> shell.moveItemToTrash(path)
    @tree.getPathsToSync().then (paths) => @fetch(paths)

  onRecievedChange: ({entries, path, parent}) =>
    console.log 'CHANGE:', path
    @tree.update(entries)
    @sync()

    parent = @convert.remoteToLocal(parent)
    @treeView()?.entryForPath(parent).reload()
