Refactor rsync

Update rsync to working code
Add methods to use web sockets to communicate with client to perform a sync
If you always assign to `buf` below (i.e., you don't use it directly), there's no need to initialize here.