$ cnpm install js-obj-rpc
RPC for javascript .
npm i js-obj-rpc
Directly require the pack.
var RPC=require('js-obj-rpc');
npm i --dev
npm run build
then use the script in the dist
directory
<script src="***/dist/rpc.js"></script>
<script>
var rpc=new RPC();
</script>
see test/
Request
instance.handle binary data sent by remote
send a request
Buffer
returns Response
instance
send a control message
ControlMsg.codes
delete a Request
or an inRequest
in the RPC's map
Request
or inRequest
instance.If the request haven't been responded,this method can cancel the operation.
An control message will be sent to remote and the inRequest
instance will emit an abort
event.
Set the timeout of the request, will be automatically invoked when sending a request.
When timeout reaches, the request will be aborted.
abort
being invokedGet data sent by remote.
15000
.Set timeout for the inRequest. When timeout reaches, an Error message will text time out
.
Message
getter
id : id of the messageGet data from the message.
Copyright 2014 - 2016 © taobao.org |