Factorize io functionality.

Generalize synching protocol for websockets in a shared namespace to
allow cljs/* implementation.