rpc for websockets and webworkers