Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / protobufjs / src / rpc.js
1 "use strict";
2
3 /**
4  * Streaming RPC helpers.
5  * @namespace
6  */
7 var rpc = exports;
8
9 /**
10  * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets.
11  * @typedef RPCImpl
12  * @type {function}
13  * @param {Method|rpc.ServiceMethod<Message<{}>,Message<{}>>} method Reflected or static method being called
14  * @param {Uint8Array} requestData Request data
15  * @param {RPCImplCallback} callback Callback function
16  * @returns {undefined}
17  * @example
18  * function rpcImpl(method, requestData, callback) {
19  *     if (protobuf.util.lcFirst(method.name) !== "myMethod") // compatible with static code
20  *         throw Error("no such method");
21  *     asynchronouslyObtainAResponse(requestData, function(err, responseData) {
22  *         callback(err, responseData);
23  *     });
24  * }
25  */
26
27 /**
28  * Node-style callback as used by {@link RPCImpl}.
29  * @typedef RPCImplCallback
30  * @type {function}
31  * @param {Error|null} error Error, if any, otherwise `null`
32  * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error
33  * @returns {undefined}
34  */
35
36 rpc.Service = require("./rpc/service");