Client and server pieces done in AMD for making JSON-RPC calls via websockets