grpc.Server.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115
  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><span class="attribs"><span class="type-signature"></span></span>
  20. <span class="ancestors"><a href="grpc.html">grpc</a>.</span>Server<span class="signature">(options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></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#line731">line 731</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">Members</h3>
  66. <h4 class="name" id="addProtoService"><span class="type-signature"></span>addProtoService<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. <dl class="details">
  71. <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>
  72. <dt class="tag-source">Source:</dt>
  73. <dd class="tag-source"><ul class="dummy"><li>
  74. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line929">line 929</a>
  75. </li></ul></dd>
  76. </dl>
  77. <h3 class="subsection-title">Methods</h3>
  78. <h4 class="name" id="addService"><span class="type-signature"></span>addService<span class="signature">(service, implementation)</span><span class="type-signature"></span></h4>
  79. <div class="description">
  80. <p>Add a service to the server, with a corresponding implementation.</p>
  81. </div>
  82. <h5>Parameters:</h5>
  83. <table class="params">
  84. <thead>
  85. <tr>
  86. <th>Name</th>
  87. <th>Type</th>
  88. <th class="last">Description</th>
  89. </tr>
  90. </thead>
  91. <tbody>
  92. <tr>
  93. <td class="name"><code>service</code></td>
  94. <td class="type">
  95. <span class="param-type"><a href="grpc.html#~ServiceDefinition">grpc~ServiceDefinition</a></span>
  96. </td>
  97. <td class="description last"><p>The service descriptor</p></td>
  98. </tr>
  99. <tr>
  100. <td class="name"><code>implementation</code></td>
  101. <td class="type">
  102. <span class="param-type">Object.&lt;String, <a href="grpc.Server.html#~handleCall">grpc.Server~handleCall</a>></span>
  103. </td>
  104. <td class="description last"><p>Map of method
  105. names to method implementation for the provided service.</p></td>
  106. </tr>
  107. </tbody>
  108. </table>
  109. <dl class="details">
  110. <dt class="tag-source">Source:</dt>
  111. <dd class="tag-source"><ul class="dummy"><li>
  112. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line870">line 870</a>
  113. </li></ul></dd>
  114. </dl>
  115. <h4 class="name" id="bind"><span class="type-signature"></span>bind<span class="signature">(port, creds)</span><span class="type-signature"></span></h4>
  116. <div class="description">
  117. <p>Binds the server to the given port, with SSL disabled if creds is an
  118. insecure credentials object</p>
  119. </div>
  120. <h5>Parameters:</h5>
  121. <table class="params">
  122. <thead>
  123. <tr>
  124. <th>Name</th>
  125. <th>Type</th>
  126. <th class="last">Description</th>
  127. </tr>
  128. </thead>
  129. <tbody>
  130. <tr>
  131. <td class="name"><code>port</code></td>
  132. <td class="type">
  133. <span class="param-type">string</span>
  134. </td>
  135. <td class="description last"><p>The port that the server should bind on, in the format
  136. &quot;address:port&quot;</p></td>
  137. </tr>
  138. <tr>
  139. <td class="name"><code>creds</code></td>
  140. <td class="type">
  141. <span class="param-type"><a href="grpc.ServerCredentials.html">grpc.ServerCredentials</a></span>
  142. </td>
  143. <td class="description last"><p>Server credential object to be used for
  144. SSL. Pass an insecure credentials object for an insecure port.</p></td>
  145. </tr>
  146. </tbody>
  147. </table>
  148. <dl class="details">
  149. <dt class="tag-source">Source:</dt>
  150. <dd class="tag-source"><ul class="dummy"><li>
  151. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line958">line 958</a>
  152. </li></ul></dd>
  153. </dl>
  154. <h4 class="name" id="forceShutdown"><span class="type-signature"></span>forceShutdown<span class="signature">()</span><span class="type-signature"></span></h4>
  155. <div class="description">
  156. <p>Forcibly shuts down the server. The server will stop receiving new calls
  157. and cancel all pending calls. When it returns, the server has shut down.
  158. This method is idempotent with itself and tryShutdown, and it will trigger
  159. any outstanding tryShutdown callbacks.</p>
  160. </div>
  161. <dl class="details">
  162. <dt class="tag-source">Source:</dt>
  163. <dd class="tag-source"><ul class="dummy"><li>
  164. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line840">line 840</a>
  165. </li></ul></dd>
  166. </dl>
  167. <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>
  168. <div class="description">
  169. <p>Registers a handler to handle the named method. Fails if there already is
  170. a handler for the given method. Returns true on success</p>
  171. </div>
  172. <h5>Parameters:</h5>
  173. <table class="params">
  174. <thead>
  175. <tr>
  176. <th>Name</th>
  177. <th>Type</th>
  178. <th class="last">Description</th>
  179. </tr>
  180. </thead>
  181. <tbody>
  182. <tr>
  183. <td class="name"><code>name</code></td>
  184. <td class="type">
  185. <span class="param-type">string</span>
  186. </td>
  187. <td class="description last"><p>The name of the method that the provided function should
  188. handle/respond to.</p></td>
  189. </tr>
  190. <tr>
  191. <td class="name"><code>handler</code></td>
  192. <td class="type">
  193. <span class="param-type"><a href="grpc.Server.html#~handleCall">grpc.Server~handleCall</a></span>
  194. </td>
  195. <td class="description last"><p>Function that takes a stream of
  196. request values and returns a stream of response values</p></td>
  197. </tr>
  198. <tr>
  199. <td class="name"><code>serialize</code></td>
  200. <td class="type">
  201. <span class="param-type"><a href="grpc.html#~serialize">grpc~serialize</a></span>
  202. </td>
  203. <td class="description last"><p>Serialization function for responses</p></td>
  204. </tr>
  205. <tr>
  206. <td class="name"><code>deserialize</code></td>
  207. <td class="type">
  208. <span class="param-type"><a href="grpc.html#~deserialize">grpc~deserialize</a></span>
  209. </td>
  210. <td class="description last"><p>Deserialization function for requests</p></td>
  211. </tr>
  212. <tr>
  213. <td class="name"><code>type</code></td>
  214. <td class="type">
  215. <span class="param-type">string</span>
  216. </td>
  217. <td class="description last"><p>The streaming type of method that this handles</p></td>
  218. </tr>
  219. </tbody>
  220. </table>
  221. <dl class="details">
  222. <dt class="tag-source">Source:</dt>
  223. <dd class="tag-source"><ul class="dummy"><li>
  224. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line809">line 809</a>
  225. </li></ul></dd>
  226. </dl>
  227. <h5>Returns:</h5>
  228. <div class="param-desc">
  229. <p>True if the handler was set. False if a handler was already
  230. set for that name.</p>
  231. </div>
  232. <dl>
  233. <dt>
  234. Type
  235. </dt>
  236. <dd>
  237. <span class="param-type">boolean</span>
  238. </dd>
  239. </dl>
  240. <h4 class="name" id="start"><span class="type-signature"></span>start<span class="signature">()</span><span class="type-signature"></span></h4>
  241. <div class="description">
  242. <p>Start the server and begin handling requests</p>
  243. </div>
  244. <dl class="details">
  245. <dt class="tag-source">Source:</dt>
  246. <dd class="tag-source"><ul class="dummy"><li>
  247. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line741">line 741</a>
  248. </li></ul></dd>
  249. </dl>
  250. <h4 class="name" id="tryShutdown"><span class="type-signature"></span>tryShutdown<span class="signature">(callback)</span><span class="type-signature"></span></h4>
  251. <div class="description">
  252. <p>Gracefully shuts down the server. The server will stop receiving new calls,
  253. and any pending calls will complete. The callback will be called when all
  254. pending calls have completed and the server is fully shut down. This method
  255. is idempotent with itself and forceShutdown.</p>
  256. </div>
  257. <h5>Parameters:</h5>
  258. <table class="params">
  259. <thead>
  260. <tr>
  261. <th>Name</th>
  262. <th>Type</th>
  263. <th class="last">Description</th>
  264. </tr>
  265. </thead>
  266. <tbody>
  267. <tr>
  268. <td class="name"><code>callback</code></td>
  269. <td class="type">
  270. <span class="param-type">function</span>
  271. </td>
  272. <td class="description last"><p>The shutdown complete callback</p></td>
  273. </tr>
  274. </tbody>
  275. </table>
  276. <dl class="details">
  277. <dt class="tag-source">Source:</dt>
  278. <dd class="tag-source"><ul class="dummy"><li>
  279. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line830">line 830</a>
  280. </li></ul></dd>
  281. </dl>
  282. <h3 class="subsection-title">Type Definitions</h3>
  283. <h4 class="name" id="~handleBidiStreamingCall"><span class="type-signature"></span>handleBidiStreamingCall<span class="signature">(call)</span><span class="type-signature"></span></h4>
  284. <div class="description">
  285. <p>User provided method to handle bidirectional streaming calls on the server.</p>
  286. </div>
  287. <h5>Parameters:</h5>
  288. <table class="params">
  289. <thead>
  290. <tr>
  291. <th>Name</th>
  292. <th>Type</th>
  293. <th class="last">Description</th>
  294. </tr>
  295. </thead>
  296. <tbody>
  297. <tr>
  298. <td class="name"><code>call</code></td>
  299. <td class="type">
  300. <span class="param-type"><a href="grpc-ServerDuplexStream.html">grpc~ServerDuplexStream</a></span>
  301. </td>
  302. <td class="description last"><p>The call object</p></td>
  303. </tr>
  304. </tbody>
  305. </table>
  306. <dl class="details">
  307. <dt class="tag-source">Source:</dt>
  308. <dd class="tag-source"><ul class="dummy"><li>
  309. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line685">line 685</a>
  310. </li></ul></dd>
  311. </dl>
  312. <h4 class="name" id="~handleCall">handleCall</h4>
  313. <div class="description">
  314. <p>Unified type for application handlers for all types of calls</p>
  315. </div>
  316. <h5>Type:</h5>
  317. <ul>
  318. <li>
  319. <span class="param-type"><a href="grpc.Server.html#~handleUnaryCall">grpc.Server~handleUnaryCall</a></span>
  320. |
  321. <span class="param-type"><a href="grpc.Server.html#~handleClientStreamingCall">grpc.Server~handleClientStreamingCall</a></span>
  322. |
  323. <span class="param-type"><a href="grpc.Server.html#~handleServerStreamingCall">grpc.Server~handleServerStreamingCall</a></span>
  324. |
  325. <span class="param-type"><a href="grpc.Server.html#~handleBidiStreamingCall">grpc.Server~handleBidiStreamingCall</a></span>
  326. </li>
  327. </ul>
  328. <dl class="details">
  329. <dt class="tag-source">Source:</dt>
  330. <dd class="tag-source"><ul class="dummy"><li>
  331. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line788">line 788</a>
  332. </li></ul></dd>
  333. </dl>
  334. <h4 class="name" id="~handleClientStreamingCall"><span class="type-signature"></span>handleClientStreamingCall<span class="signature">(call, callback)</span><span class="type-signature"></span></h4>
  335. <div class="description">
  336. <p>User provided method to handle client streaming methods on the server.</p>
  337. </div>
  338. <h5>Parameters:</h5>
  339. <table class="params">
  340. <thead>
  341. <tr>
  342. <th>Name</th>
  343. <th>Type</th>
  344. <th class="last">Description</th>
  345. </tr>
  346. </thead>
  347. <tbody>
  348. <tr>
  349. <td class="name"><code>call</code></td>
  350. <td class="type">
  351. <span class="param-type"><a href="grpc-ServerReadableStream.html">grpc~ServerReadableStream</a></span>
  352. </td>
  353. <td class="description last"><p>The call object</p></td>
  354. </tr>
  355. <tr>
  356. <td class="name"><code>callback</code></td>
  357. <td class="type">
  358. <span class="param-type"><a href="grpc.Server.html#~sendUnaryData">grpc.Server~sendUnaryData</a></span>
  359. </td>
  360. <td class="description last"><p>The callback to call to respond
  361. to the request</p></td>
  362. </tr>
  363. </tbody>
  364. </table>
  365. <dl class="details">
  366. <dt class="tag-source">Source:</dt>
  367. <dd class="tag-source"><ul class="dummy"><li>
  368. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line645">line 645</a>
  369. </li></ul></dd>
  370. </dl>
  371. <h4 class="name" id="~handleServerStreamingCall"><span class="type-signature"></span>handleServerStreamingCall<span class="signature">(call)</span><span class="type-signature"></span></h4>
  372. <div class="description">
  373. <p>User provided method to handle server streaming methods on the server.</p>
  374. </div>
  375. <h5>Parameters:</h5>
  376. <table class="params">
  377. <thead>
  378. <tr>
  379. <th>Name</th>
  380. <th>Type</th>
  381. <th class="last">Description</th>
  382. </tr>
  383. </thead>
  384. <tbody>
  385. <tr>
  386. <td class="name"><code>call</code></td>
  387. <td class="type">
  388. <span class="param-type"><a href="grpc-ServerWritableStream.html">grpc~ServerWritableStream</a></span>
  389. </td>
  390. <td class="description last"><p>The call object</p></td>
  391. </tr>
  392. </tbody>
  393. </table>
  394. <dl class="details">
  395. <dt class="tag-source">Source:</dt>
  396. <dd class="tag-source"><ul class="dummy"><li>
  397. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line605">line 605</a>
  398. </li></ul></dd>
  399. </dl>
  400. <h4 class="name" id="~handleUnaryCall"><span class="type-signature"></span>handleUnaryCall<span class="signature">(call, callback)</span><span class="type-signature"></span></h4>
  401. <div class="description">
  402. <p>User-provided method to handle unary requests on a server</p>
  403. </div>
  404. <h5>Parameters:</h5>
  405. <table class="params">
  406. <thead>
  407. <tr>
  408. <th>Name</th>
  409. <th>Type</th>
  410. <th class="last">Description</th>
  411. </tr>
  412. </thead>
  413. <tbody>
  414. <tr>
  415. <td class="name"><code>call</code></td>
  416. <td class="type">
  417. <span class="param-type"><a href="grpc-ServerUnaryCall.html">grpc~ServerUnaryCall</a></span>
  418. </td>
  419. <td class="description last"><p>The call object</p></td>
  420. </tr>
  421. <tr>
  422. <td class="name"><code>callback</code></td>
  423. <td class="type">
  424. <span class="param-type"><a href="grpc.Server.html#~sendUnaryData">grpc.Server~sendUnaryData</a></span>
  425. </td>
  426. <td class="description last"><p>The callback to call to respond
  427. to the request</p></td>
  428. </tr>
  429. </tbody>
  430. </table>
  431. <dl class="details">
  432. <dt class="tag-source">Source:</dt>
  433. <dd class="tag-source"><ul class="dummy"><li>
  434. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line549">line 549</a>
  435. </li></ul></dd>
  436. </dl>
  437. <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>
  438. <div class="description">
  439. <p>Callback function passed to server handlers that handle methods with unary
  440. responses.</p>
  441. </div>
  442. <h5>Parameters:</h5>
  443. <table class="params">
  444. <thead>
  445. <tr>
  446. <th>Name</th>
  447. <th>Type</th>
  448. <th>Attributes</th>
  449. <th class="last">Description</th>
  450. </tr>
  451. </thead>
  452. <tbody>
  453. <tr>
  454. <td class="name"><code>error</code></td>
  455. <td class="type">
  456. <span class="param-type"><a href="grpc.html#~ServiceError">grpc~ServiceError</a></span>
  457. </td>
  458. <td class="attributes">
  459. </td>
  460. <td class="description last"><p>An error, if the call failed</p></td>
  461. </tr>
  462. <tr>
  463. <td class="name"><code>value</code></td>
  464. <td class="type">
  465. <span class="param-type">*</span>
  466. </td>
  467. <td class="attributes">
  468. </td>
  469. <td class="description last"><p>The response value. Must be a valid argument to the
  470. <code>responseSerialize</code> method of the method that is being handled</p></td>
  471. </tr>
  472. <tr>
  473. <td class="name"><code>trailer</code></td>
  474. <td class="type">
  475. <span class="param-type"><a href="grpc.Metadata.html">grpc.Metadata</a></span>
  476. </td>
  477. <td class="attributes">
  478. &lt;optional><br>
  479. </td>
  480. <td class="description last"><p>Trailing metadata to send, if applicable</p></td>
  481. </tr>
  482. <tr>
  483. <td class="name"><code>flags</code></td>
  484. <td class="type">
  485. <span class="param-type"><a href="grpc.html#.writeFlags">grpc.writeFlags</a></span>
  486. </td>
  487. <td class="attributes">
  488. &lt;optional><br>
  489. </td>
  490. <td class="description last"><p>Flags to modify writing the response</p></td>
  491. </tr>
  492. </tbody>
  493. </table>
  494. <dl class="details">
  495. <dt class="tag-source">Source:</dt>
  496. <dd class="tag-source"><ul class="dummy"><li>
  497. <a href="src_server.js.html">src/server.js</a>, <a href="src_server.js.html#line538">line 538</a>
  498. </li></ul></dd>
  499. </dl>
  500. </article>
  501. </section>
  502. </div>
  503. <nav>
  504. <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>
  505. </nav>
  506. <br class="clear">
  507. <footer>
  508. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.3</a> on Fri Sep 08 2017 11:10:31 GMT-0700 (PDT)
  509. </footer>
  510. <script> prettyPrint(); </script>
  511. <script src="scripts/linenumber.js"> </script>
  512. </body>
  513. </html>