WIP: Ws client code

I don't love the pattern of globals you use throughout this file.  I think it might make more sense for each sync to be an instance object, where `init()` calls a ctor, and then you can call a method `sync` on that instance, which does all the steps above.  Then the callback, path, sync, filesystem, etc can be properties or locals on that instance.