grpc.Server.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Class: Server</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  13. </head>
  14. <body>
  15. <div id="main">
  16. <h1 class="page-title">Class: Server</h1>
  17. <section>
  18. <header>
  19. <h2>
  20. <span class="ancestors"><a href="grpc.html">grpc</a>.</span>Server</h2>
  21. </header>
  22. <article>
  23. <div class="container-overview">
  24. <h4 class="name" id="Server"><span class="type-signature"></span>new Server<span class="signature">(options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
  25. <div class="description">
  26. <p>Constructs a server object that stores request handlers and delegates
  27. incoming requests to those handlers</p>
  28. </div>
  29. <h5>Parameters:</h5>
  30. <table class="params">
  31. <thead>
  32. <tr>
  33. <th>Name</th>
  34. <th>Type</th>
  35. <th>Attributes</th>
  36. <th class="last">Description</th>
  37. </tr>
  38. </thead>
  39. <tbody>
  40. <tr>
  41. <td class="name"><code>options</code></td>
  42. <td class="type">
  43. <span class="param-type">Object</span>
  44. </td>
  45. <td class="attributes">
  46. &lt;optional><br>
  47. </td>
  48. <td class="description last"><p>Options that should be passed to the internal server
  49. implementation</p></td>
  50. </tr>
  51. </tbody>
  52. </table>
  53. <dl class="details">
  54. <dt class="tag-source">Source:</dt>
  55. <dd class="tag-source"><ul class="dummy"><li>
  56. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line746">line 746</a>
  57. </li></ul></dd>
  58. </dl>
  59. <h5>Example</h5>
  60. <pre class="prettyprint"><code>var server = new grpc.Server();
  61. server.addProtoService(protobuf_service_descriptor, service_implementation);
  62. server.bind('address:port', server_credential);
  63. server.start();</code></pre>
  64. </div>
  65. <h3 class="subsection-title">Methods</h3>
  66. <h4 class="name" id="addProtoService"><span class="type-signature"></span>addProtoService<span class="signature">(service, implementation)</span><span class="type-signature"></span></h4>
  67. <div class="description">
  68. <p>Add a proto service to the server, with a corresponding implementation</p>
  69. </div>
  70. <h5>Parameters:</h5>
  71. <table class="params">
  72. <thead>
  73. <tr>
  74. <th>Name</th>
  75. <th>Type</th>
  76. <th class="last">Description</th>
  77. </tr>
  78. </thead>
  79. <tbody>
  80. <tr>
  81. <td class="name"><code>service</code></td>
  82. <td class="type">
  83. <span class="param-type">Protobuf.Reflect.Service</span>
  84. </td>
  85. <td class="description last"><p>The proto service descriptor</p></td>
  86. </tr>
  87. <tr>
  88. <td class="name"><code>implementation</code></td>
  89. <td class="type">
  90. <span class="param-type">Object.&lt;String, <a href="grpc.Server.html#~handleCall">grpc.Server~handleCall</a>></span>
  91. </td>
  92. <td class="description last"><p>Map of method
  93. names to method implementation for the provided service.</p></td>
  94. </tr>
  95. </tbody>
  96. </table>
  97. <dl class="details">
  98. <dt class="important tag-deprecated">Deprecated:</dt><dd><ul class="dummy"><li>Use <a href="grpc.Server.html#addService">grpc.Server#addService</a> instead</li></ul></dd>
  99. <dt class="tag-source">Source:</dt>
  100. <dd class="tag-source"><ul class="dummy"><li>
  101. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line949">line 949</a>
  102. </li></ul></dd>
  103. </dl>
  104. <h4 class="name" id="addService"><span class="type-signature"></span>addService<span class="signature">(service, implementation)</span><span class="type-signature"></span></h4>
  105. <div class="description">
  106. <p>Add a service to the server, with a corresponding implementation.</p>
  107. </div>
  108. <h5>Parameters:</h5>
  109. <table class="params">
  110. <thead>
  111. <tr>
  112. <th>Name</th>
  113. <th>Type</th>
  114. <th class="last">Description</th>
  115. </tr>
  116. </thead>
  117. <tbody>
  118. <tr>
  119. <td class="name"><code>service</code></td>
  120. <td class="type">
  121. <span class="param-type"><a href="grpc.html#~ServiceDefinition">grpc~ServiceDefinition</a></span>
  122. </td>
  123. <td class="description last"><p>The service descriptor</p></td>
  124. </tr>
  125. <tr>
  126. <td class="name"><code>implementation</code></td>
  127. <td class="type">
  128. <span class="param-type">Object.&lt;String, <a href="grpc.Server.html#~handleCall">grpc.Server~handleCall</a>></span>
  129. </td>
  130. <td class="description last"><p>Map of method
  131. names to method implementation for the provided service.</p></td>
  132. </tr>
  133. </tbody>
  134. </table>
  135. <dl class="details">
  136. <dt class="tag-source">Source:</dt>
  137. <dd class="tag-source"><ul class="dummy"><li>
  138. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line885">line 885</a>
  139. </li></ul></dd>
  140. </dl>
  141. <h4 class="name" id="bind"><span class="type-signature"></span>bind<span class="signature">(port, creds)</span><span class="type-signature"></span></h4>
  142. <div class="description">
  143. <p>Binds the server to the given port, with SSL disabled if creds is an
  144. insecure credentials object</p>
  145. </div>
  146. <h5>Parameters:</h5>
  147. <table class="params">
  148. <thead>
  149. <tr>
  150. <th>Name</th>
  151. <th>Type</th>
  152. <th class="last">Description</th>
  153. </tr>
  154. </thead>
  155. <tbody>
  156. <tr>
  157. <td class="name"><code>port</code></td>
  158. <td class="type">
  159. <span class="param-type">string</span>
  160. </td>
  161. <td class="description last"><p>The port that the server should bind on, in the format
  162. &quot;address:port&quot;</p></td>
  163. </tr>
  164. <tr>
  165. <td class="name"><code>creds</code></td>
  166. <td class="type">
  167. <span class="param-type"><a href="grpc.ServerCredentials.html">grpc.ServerCredentials</a></span>
  168. </td>
  169. <td class="description last"><p>Server credential object to be used for
  170. SSL. Pass an insecure credentials object for an insecure port.</p></td>
  171. </tr>
  172. </tbody>
  173. </table>
  174. <dl class="details">
  175. <dt class="tag-source">Source:</dt>
  176. <dd class="tag-source"><ul class="dummy"><li>
  177. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line978">line 978</a>
  178. </li></ul></dd>
  179. </dl>
  180. <h4 class="name" id="forceShutdown"><span class="type-signature"></span>forceShutdown<span class="signature">()</span><span class="type-signature"></span></h4>
  181. <div class="description">
  182. <p>Forcibly shuts down the server. The server will stop receiving new calls
  183. and cancel all pending calls. When it returns, the server has shut down.
  184. This method is idempotent with itself and tryShutdown, and it will trigger
  185. any outstanding tryShutdown callbacks.</p>
  186. </div>
  187. <dl class="details">
  188. <dt class="tag-source">Source:</dt>
  189. <dd class="tag-source"><ul class="dummy"><li>
  190. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line855">line 855</a>
  191. </li></ul></dd>
  192. </dl>
  193. <h4 class="name" id="register"><span class="type-signature"></span>register<span class="signature">(name, handler, serialize, deserialize, type)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
  194. <div class="description">
  195. <p>Registers a handler to handle the named method. Fails if there already is
  196. a handler for the given method. Returns true on success</p>
  197. </div>
  198. <h5>Parameters:</h5>
  199. <table class="params">
  200. <thead>
  201. <tr>
  202. <th>Name</th>
  203. <th>Type</th>
  204. <th class="last">Description</th>
  205. </tr>
  206. </thead>
  207. <tbody>
  208. <tr>
  209. <td class="name"><code>name</code></td>
  210. <td class="type">
  211. <span class="param-type">string</span>
  212. </td>
  213. <td class="description last"><p>The name of the method that the provided function should
  214. handle/respond to.</p></td>
  215. </tr>
  216. <tr>
  217. <td class="name"><code>handler</code></td>
  218. <td class="type">
  219. <span class="param-type"><a href="grpc.Server.html#~handleCall">grpc.Server~handleCall</a></span>
  220. </td>
  221. <td class="description last"><p>Function that takes a stream of
  222. request values and returns a stream of response values</p></td>
  223. </tr>
  224. <tr>
  225. <td class="name"><code>serialize</code></td>
  226. <td class="type">
  227. <span class="param-type"><a href="grpc.html#~serialize">grpc~serialize</a></span>
  228. </td>
  229. <td class="description last"><p>Serialization function for responses</p></td>
  230. </tr>
  231. <tr>
  232. <td class="name"><code>deserialize</code></td>
  233. <td class="type">
  234. <span class="param-type"><a href="grpc.html#~deserialize">grpc~deserialize</a></span>
  235. </td>
  236. <td class="description last"><p>Deserialization function for requests</p></td>
  237. </tr>
  238. <tr>
  239. <td class="name"><code>type</code></td>
  240. <td class="type">
  241. <span class="param-type">string</span>
  242. </td>
  243. <td class="description last"><p>The streaming type of method that this handles</p></td>
  244. </tr>
  245. </tbody>
  246. </table>
  247. <dl class="details">
  248. <dt class="tag-source">Source:</dt>
  249. <dd class="tag-source"><ul class="dummy"><li>
  250. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line824">line 824</a>
  251. </li></ul></dd>
  252. </dl>
  253. <h5>Returns:</h5>
  254. <div class="param-desc">
  255. <p>True if the handler was set. False if a handler was already
  256. set for that name.</p>
  257. </div>
  258. <dl>
  259. <dt>
  260. Type
  261. </dt>
  262. <dd>
  263. <span class="param-type">boolean</span>
  264. </dd>
  265. </dl>
  266. <h4 class="name" id="start"><span class="type-signature"></span>start<span class="signature">()</span><span class="type-signature"></span></h4>
  267. <div class="description">
  268. <p>Start the server and begin handling requests</p>
  269. </div>
  270. <dl class="details">
  271. <dt class="tag-source">Source:</dt>
  272. <dd class="tag-source"><ul class="dummy"><li>
  273. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line756">line 756</a>
  274. </li></ul></dd>
  275. </dl>
  276. <h4 class="name" id="tryShutdown"><span class="type-signature"></span>tryShutdown<span class="signature">(callback)</span><span class="type-signature"></span></h4>
  277. <div class="description">
  278. <p>Gracefully shuts down the server. The server will stop receiving new calls,
  279. and any pending calls will complete. The callback will be called when all
  280. pending calls have completed and the server is fully shut down. This method
  281. is idempotent with itself and forceShutdown.</p>
  282. </div>
  283. <h5>Parameters:</h5>
  284. <table class="params">
  285. <thead>
  286. <tr>
  287. <th>Name</th>
  288. <th>Type</th>
  289. <th class="last">Description</th>
  290. </tr>
  291. </thead>
  292. <tbody>
  293. <tr>
  294. <td class="name"><code>callback</code></td>
  295. <td class="type">
  296. <span class="param-type">function</span>
  297. </td>
  298. <td class="description last"><p>The shutdown complete callback</p></td>
  299. </tr>
  300. </tbody>
  301. </table>
  302. <dl class="details">
  303. <dt class="tag-source">Source:</dt>
  304. <dd class="tag-source"><ul class="dummy"><li>
  305. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line845">line 845</a>
  306. </li></ul></dd>
  307. </dl>
  308. <h3 class="subsection-title">Type Definitions</h3>
  309. <h4 class="name" id="~handleBidiStreamingCall"><span class="type-signature"></span>handleBidiStreamingCall<span class="signature">(call)</span><span class="type-signature"></span></h4>
  310. <div class="description">
  311. <p>User provided method to handle bidirectional streaming calls on the server.</p>
  312. </div>
  313. <h5>Parameters:</h5>
  314. <table class="params">
  315. <thead>
  316. <tr>
  317. <th>Name</th>
  318. <th>Type</th>
  319. <th class="last">Description</th>
  320. </tr>
  321. </thead>
  322. <tbody>
  323. <tr>
  324. <td class="name"><code>call</code></td>
  325. <td class="type">
  326. <span class="param-type"><a href="grpc-ServerDuplexStream.html">grpc~ServerDuplexStream</a></span>
  327. </td>
  328. <td class="description last"><p>The call object</p></td>
  329. </tr>
  330. </tbody>
  331. </table>
  332. <dl class="details">
  333. <dt class="tag-source">Source:</dt>
  334. <dd class="tag-source"><ul class="dummy"><li>
  335. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line700">line 700</a>
  336. </li></ul></dd>
  337. </dl>
  338. <h4 class="name" id="~handleCall">handleCall</h4>
  339. <div class="description">
  340. <p>Unified type for application handlers for all types of calls</p>
  341. </div>
  342. <h5>Type:</h5>
  343. <ul>
  344. <li>
  345. <span class="param-type"><a href="grpc.Server.html#~handleUnaryCall">grpc.Server~handleUnaryCall</a></span>
  346. |
  347. <span class="param-type"><a href="grpc.Server.html#~handleClientStreamingCall">grpc.Server~handleClientStreamingCall</a></span>
  348. |
  349. <span class="param-type"><a href="grpc.Server.html#~handleServerStreamingCall">grpc.Server~handleServerStreamingCall</a></span>
  350. |
  351. <span class="param-type"><a href="grpc.Server.html#~handleBidiStreamingCall">grpc.Server~handleBidiStreamingCall</a></span>
  352. </li>
  353. </ul>
  354. <dl class="details">
  355. <dt class="tag-source">Source:</dt>
  356. <dd class="tag-source"><ul class="dummy"><li>
  357. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line803">line 803</a>
  358. </li></ul></dd>
  359. </dl>
  360. <h4 class="name" id="~handleClientStreamingCall"><span class="type-signature"></span>handleClientStreamingCall<span class="signature">(call, callback)</span><span class="type-signature"></span></h4>
  361. <div class="description">
  362. <p>User provided method to handle client streaming methods on the server.</p>
  363. </div>
  364. <h5>Parameters:</h5>
  365. <table class="params">
  366. <thead>
  367. <tr>
  368. <th>Name</th>
  369. <th>Type</th>
  370. <th class="last">Description</th>
  371. </tr>
  372. </thead>
  373. <tbody>
  374. <tr>
  375. <td class="name"><code>call</code></td>
  376. <td class="type">
  377. <span class="param-type"><a href="grpc-ServerReadableStream.html">grpc~ServerReadableStream</a></span>
  378. </td>
  379. <td class="description last"><p>The call object</p></td>
  380. </tr>
  381. <tr>
  382. <td class="name"><code>callback</code></td>
  383. <td class="type">
  384. <span class="param-type"><a href="grpc.Server.html#~sendUnaryData">grpc.Server~sendUnaryData</a></span>
  385. </td>
  386. <td class="description last"><p>The callback to call to respond
  387. to the request</p></td>
  388. </tr>
  389. </tbody>
  390. </table>
  391. <dl class="details">
  392. <dt class="tag-source">Source:</dt>
  393. <dd class="tag-source"><ul class="dummy"><li>
  394. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line660">line 660</a>
  395. </li></ul></dd>
  396. </dl>
  397. <h4 class="name" id="~handleServerStreamingCall"><span class="type-signature"></span>handleServerStreamingCall<span class="signature">(call)</span><span class="type-signature"></span></h4>
  398. <div class="description">
  399. <p>User provided method to handle server streaming methods on the server.</p>
  400. </div>
  401. <h5>Parameters:</h5>
  402. <table class="params">
  403. <thead>
  404. <tr>
  405. <th>Name</th>
  406. <th>Type</th>
  407. <th class="last">Description</th>
  408. </tr>
  409. </thead>
  410. <tbody>
  411. <tr>
  412. <td class="name"><code>call</code></td>
  413. <td class="type">
  414. <span class="param-type"><a href="grpc-ServerWritableStream.html">grpc~ServerWritableStream</a></span>
  415. </td>
  416. <td class="description last"><p>The call object</p></td>
  417. </tr>
  418. </tbody>
  419. </table>
  420. <dl class="details">
  421. <dt class="tag-source">Source:</dt>
  422. <dd class="tag-source"><ul class="dummy"><li>
  423. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line620">line 620</a>
  424. </li></ul></dd>
  425. </dl>
  426. <h4 class="name" id="~handleUnaryCall"><span class="type-signature"></span>handleUnaryCall<span class="signature">(call, callback)</span><span class="type-signature"></span></h4>
  427. <div class="description">
  428. <p>User-provided method to handle unary requests on a server</p>
  429. </div>
  430. <h5>Parameters:</h5>
  431. <table class="params">
  432. <thead>
  433. <tr>
  434. <th>Name</th>
  435. <th>Type</th>
  436. <th class="last">Description</th>
  437. </tr>
  438. </thead>
  439. <tbody>
  440. <tr>
  441. <td class="name"><code>call</code></td>
  442. <td class="type">
  443. <span class="param-type"><a href="grpc-ServerUnaryCall.html">grpc~ServerUnaryCall</a></span>
  444. </td>
  445. <td class="description last"><p>The call object</p></td>
  446. </tr>
  447. <tr>
  448. <td class="name"><code>callback</code></td>
  449. <td class="type">
  450. <span class="param-type"><a href="grpc.Server.html#~sendUnaryData">grpc.Server~sendUnaryData</a></span>
  451. </td>
  452. <td class="description last"><p>The callback to call to respond
  453. to the request</p></td>
  454. </tr>
  455. </tbody>
  456. </table>
  457. <dl class="details">
  458. <dt class="tag-source">Source:</dt>
  459. <dd class="tag-source"><ul class="dummy"><li>
  460. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line564">line 564</a>
  461. </li></ul></dd>
  462. </dl>
  463. <h4 class="name" id="~sendUnaryData"><span class="type-signature"></span>sendUnaryData<span class="signature">(error, value, trailer<span class="signature-attributes">opt</span>, flags<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
  464. <div class="description">
  465. <p>Callback function passed to server handlers that handle methods with unary
  466. responses.</p>
  467. </div>
  468. <h5>Parameters:</h5>
  469. <table class="params">
  470. <thead>
  471. <tr>
  472. <th>Name</th>
  473. <th>Type</th>
  474. <th>Attributes</th>
  475. <th class="last">Description</th>
  476. </tr>
  477. </thead>
  478. <tbody>
  479. <tr>
  480. <td class="name"><code>error</code></td>
  481. <td class="type">
  482. <span class="param-type"><a href="grpc.html#~ServiceError">grpc~ServiceError</a></span>
  483. </td>
  484. <td class="attributes">
  485. </td>
  486. <td class="description last"><p>An error, if the call failed</p></td>
  487. </tr>
  488. <tr>
  489. <td class="name"><code>value</code></td>
  490. <td class="type">
  491. <span class="param-type">*</span>
  492. </td>
  493. <td class="attributes">
  494. </td>
  495. <td class="description last"><p>The response value. Must be a valid argument to the
  496. <code>responseSerialize</code> method of the method that is being handled</p></td>
  497. </tr>
  498. <tr>
  499. <td class="name"><code>trailer</code></td>
  500. <td class="type">
  501. <span class="param-type"><a href="grpc.Metadata.html">grpc.Metadata</a></span>
  502. </td>
  503. <td class="attributes">
  504. &lt;optional><br>
  505. </td>
  506. <td class="description last"><p>Trailing metadata to send, if applicable</p></td>
  507. </tr>
  508. <tr>
  509. <td class="name"><code>flags</code></td>
  510. <td class="type">
  511. <span class="param-type"><a href="grpc.html#.writeFlags">grpc.writeFlags</a></span>
  512. </td>
  513. <td class="attributes">
  514. &lt;optional><br>
  515. </td>
  516. <td class="description last"><p>Flags to modify writing the response</p></td>
  517. </tr>
  518. </tbody>
  519. </table>
  520. <dl class="details">
  521. <dt class="tag-source">Source:</dt>
  522. <dd class="tag-source"><ul class="dummy"><li>
  523. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line553">line 553</a>
  524. </li></ul></dd>
  525. </dl>
  526. </article>
  527. </section>
  528. </div>
  529. <nav>
  530. <h2><a href="index.html">Home</a></h2><h3>Externals</h3><ul><li><a href="external-Duplex.html">Duplex</a></li><li><a href="external-EventEmitter.html">EventEmitter</a></li><li><a href="external-GoogleCredential.html">GoogleCredential</a></li><li><a href="external-Readable.html">Readable</a></li><li><a href="external-Writable.html">Writable</a></li></ul><h3>Classes</h3><ul><li><a href="grpc.Client.html">Client</a></li><li><a href="grpc.credentials-CallCredentials.html">CallCredentials</a></li><li><a href="grpc.credentials-ChannelCredentials.html">ChannelCredentials</a></li><li><a href="grpc.Metadata.html">Metadata</a></li><li><a href="grpc.Server.html">Server</a></li><li><a href="grpc.ServerCredentials.html">ServerCredentials</a></li><li><a href="grpc-ClientDuplexStream.html">ClientDuplexStream</a></li><li><a href="grpc-ClientReadableStream.html">ClientReadableStream</a></li><li><a href="grpc-ClientUnaryCall.html">ClientUnaryCall</a></li><li><a href="grpc-ClientWritableStream.html">ClientWritableStream</a></li><li><a href="grpc-ServerDuplexStream.html">ServerDuplexStream</a></li><li><a href="grpc-ServerReadableStream.html">ServerReadableStream</a></li><li><a href="grpc-ServerUnaryCall.html">ServerUnaryCall</a></li><li><a href="grpc-ServerWritableStream.html">ServerWritableStream</a></li></ul><h3>Events</h3><ul><li><a href="grpc-ClientDuplexStream.html#event:metadata">metadata</a></li><li><a href="grpc-ClientDuplexStream.html#event:status">status</a></li><li><a href="grpc-ClientReadableStream.html#event:metadata">metadata</a></li><li><a href="grpc-ClientReadableStream.html#event:status">status</a></li><li><a href="grpc-ClientUnaryCall.html#event:metadata">metadata</a></li><li><a href="grpc-ClientUnaryCall.html#event:status">status</a></li><li><a href="grpc-ClientWritableStream.html#event:metadata">metadata</a></li><li><a href="grpc-ClientWritableStream.html#event:status">status</a></li><li><a href="grpc-ServerDuplexStream.html#~event:cancelled">cancelled</a></li><li><a href="grpc-ServerReadableStream.html#~event:cancelled">cancelled</a></li><li><a href="grpc-ServerUnaryCall.html#~event:cancelled">cancelled</a></li><li><a href="grpc-ServerWritableStream.html#~event:cancelled">cancelled</a></li></ul><h3>Namespaces</h3><ul><li><a href="grpc.html">grpc</a></li><li><a href="grpc.credentials.html">credentials</a></li></ul>
  531. </nav>
  532. <br class="clear">
  533. <footer>
  534. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Wed Jun 28 2017 09:44:06 GMT-0700 (PDT)
  535. </footer>
  536. <script> prettyPrint(); </script>
  537. <script src="scripts/linenumber.js"> </script>
  538. </body>
  539. </html>