change scope of rpc functions to the socket they're called on

currently there is no way to know which socket/session that the rpc call is executing for.