module-src_client_interceptors-InterceptingCall.html 21 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>Documentation Class: InterceptingCall</title>
  7. <!--[if lt IE 9]>
  8. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  9. <![endif]-->
  10. <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
  11. <link type="text/css" rel="stylesheet" href="styles/site.simplex.css">
  12. </head>
  13. <body>
  14. <div class="navbar navbar-default navbar-fixed-top ">
  15. <div class="container">
  16. <div class="navbar-header">
  17. <a class="navbar-brand" href="index.html">Documentation</a>
  18. <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
  19. <span class="icon-bar"></span>
  20. <span class="icon-bar"></span>
  21. <span class="icon-bar"></span>
  22. </button>
  23. </div>
  24. <div class="navbar-collapse collapse" id="topNavigation">
  25. <ul class="nav navbar-nav">
  26. <li class="dropdown">
  27. <a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b class="caret"></b></a>
  28. <ul class="dropdown-menu ">
  29. <li><a href="grpc.html">grpc</a></li><li><a href="grpc.credentials.html">grpc.credentials</a></li>
  30. </ul>
  31. </li>
  32. <li class="dropdown">
  33. <a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b class="caret"></b></a>
  34. <ul class="dropdown-menu ">
  35. <li><a href="module-src_client_interceptors.html">src/client_interceptors</a></li>
  36. </ul>
  37. </li>
  38. <li class="dropdown">
  39. <a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a>
  40. <ul class="dropdown-menu ">
  41. <li><a href="grpc.Channel.html">grpc.Channel</a></li><li><a href="grpc.Client.html">grpc.Client</a></li><li><a href="grpc.credentials-CallCredentials.html">grpc.credentials~CallCredentials</a></li><li><a href="grpc.credentials-ChannelCredentials.html">grpc.credentials~ChannelCredentials</a></li><li><a href="grpc.Metadata.html">grpc.Metadata</a></li><li><a href="grpc.Server.html">grpc.Server</a></li><li><a href="grpc.ServerCredentials.html">grpc.ServerCredentials</a></li><li><a href="grpc-Call.html">grpc~Call</a></li><li><a href="grpc-ClientDuplexStream.html">grpc~ClientDuplexStream</a></li><li><a href="grpc-ClientReadableStream.html">grpc~ClientReadableStream</a></li><li><a href="grpc-ClientUnaryCall.html">grpc~ClientUnaryCall</a></li><li><a href="grpc-ClientWritableStream.html">grpc~ClientWritableStream</a></li><li><a href="grpc-ServerDuplexStream.html">grpc~ServerDuplexStream</a></li><li><a href="grpc-ServerReadableStream.html">grpc~ServerReadableStream</a></li><li><a href="grpc-ServerUnaryCall.html">grpc~ServerUnaryCall</a></li><li><a href="grpc-ServerWritableStream.html">grpc~ServerWritableStream</a></li><li><a href="module-src_client_interceptors-EndListener.html">src/client_interceptors~EndListener</a></li><li><a href="module-src_client_interceptors-InterceptingCall.html">src/client_interceptors~InterceptingCall</a></li><li><a href="module-src_client_interceptors-InterceptingListener.html">src/client_interceptors~InterceptingListener</a></li><li><a href="module-src_client_interceptors-InterceptorConfigurationError.html">src/client_interceptors~InterceptorConfigurationError</a></li><li><a href="module-src_client_interceptors-ListenerBuilder.html">src/client_interceptors~ListenerBuilder</a></li><li><a href="module-src_client_interceptors-RequesterBuilder.html">src/client_interceptors~RequesterBuilder</a></li><li><a href="module-src_client_interceptors-StatusBuilder.html">src/client_interceptors~StatusBuilder</a></li>
  42. </ul>
  43. </li>
  44. <li class="dropdown">
  45. <a href="events.list.html" class="dropdown-toggle" data-toggle="dropdown">Events<b class="caret"></b></a>
  46. <ul class="dropdown-menu ">
  47. <li><a href="grpc-ClientDuplexStream.html#event:metadata">grpc~ClientDuplexStream#metadata</a></li><li><a href="grpc-ClientDuplexStream.html#event:status">grpc~ClientDuplexStream#status</a></li><li><a href="grpc-ClientReadableStream.html#event:metadata">grpc~ClientReadableStream#metadata</a></li><li><a href="grpc-ClientReadableStream.html#event:status">grpc~ClientReadableStream#status</a></li><li><a href="grpc-ClientUnaryCall.html#event:metadata">grpc~ClientUnaryCall#event:metadata</a></li><li><a href="grpc-ClientUnaryCall.html#event:status">grpc~ClientUnaryCall#event:status</a></li><li><a href="grpc-ClientWritableStream.html#event:metadata">grpc~ClientWritableStream#metadata</a></li><li><a href="grpc-ClientWritableStream.html#event:status">grpc~ClientWritableStream#status</a></li><li><a href="grpc-ServerDuplexStream.html#~event:cancelled">grpc~ServerDuplexStream~event:cancelled</a></li><li><a href="grpc-ServerReadableStream.html#~event:cancelled">grpc~ServerReadableStream~event:cancelled</a></li><li><a href="grpc-ServerUnaryCall.html#~event:cancelled">grpc~ServerUnaryCall~event:cancelled</a></li><li><a href="grpc-ServerWritableStream.html#~event:cancelled">grpc~ServerWritableStream~event:cancelled</a></li>
  48. </ul>
  49. </li>
  50. <li class="dropdown">
  51. <a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
  52. <ul class="dropdown-menu ">
  53. <li><a href="global.html#CancelRequester">CancelRequester</a></li><li><a href="global.html#CloseRequester">CloseRequester</a></li><li><a href="global.html#createStatusError">createStatusError</a></li><li><a href="global.html#getClientInterceptors">getClientInterceptors</a></li><li><a href="global.html#getMethodType">getMethodType</a></li><li><a href="global.html#GetPeerRequester">GetPeerRequester</a></li><li><a href="global.html#Interceptor">Interceptor</a></li><li><a href="global.html#InterceptorProvider">InterceptorProvider</a></li><li><a href="global.html#loadPackageDefinition">loadPackageDefinition</a></li><li><a href="global.html#MessageListener">MessageListener</a></li><li><a href="global.html#MessageRequester">MessageRequester</a></li><li><a href="global.html#MetadataListener">MetadataListener</a></li><li><a href="global.html#MetadataRequester">MetadataRequester</a></li><li><a href="global.html#NextCall">NextCall</a></li><li><a href="global.html#StatusListener">StatusListener</a></li>
  54. </ul>
  55. </li>
  56. <li class="dropdown">
  57. <a href="externals.list.html" class="dropdown-toggle" data-toggle="dropdown">Externals<b class="caret"></b></a>
  58. <ul class="dropdown-menu ">
  59. <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>
  60. </ul>
  61. </li>
  62. </ul>
  63. <div class="col-sm-3 col-md-3">
  64. <form class="navbar-form" role="search">
  65. <div class="input-group">
  66. <input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
  67. <div class="input-group-btn">
  68. <button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
  69. </div>
  70. </div>
  71. </form>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. <div class="container" id="toc-content">
  77. <div class="row">
  78. <div class="col-md-8">
  79. <div id="main">
  80. <h1 class="page-title">Class: InterceptingCall</h1>
  81. <section>
  82. <header>
  83. <h2>
  84. <span class="ancestors"><a href="module-src_client_interceptors.html">src/client_interceptors</a>~</span>
  85. InterceptingCall
  86. </h2>
  87. </header>
  88. <article>
  89. <div class="container-overview">
  90. <hr>
  91. <dt>
  92. <h4 class="name" id="InterceptingCall"><span class="type-signature"></span>new InterceptingCall(next_call [, requester])</h4>
  93. </dt>
  94. <dd>
  95. <div class="description">
  96. <p>A chainable gRPC call proxy which will delegate to an optional requester
  97. object. By default, interceptor methods will chain to next_call. If a
  98. requester is provided which implements an interceptor method, that
  99. requester method will be executed as part of the chain.</p>
  100. </div>
  101. <h5>Parameters:</h5>
  102. <table class="params table table-striped">
  103. <thead>
  104. <tr>
  105. <th>Name</th>
  106. <th>Type</th>
  107. <th>Argument</th>
  108. <th class="last">Description</th>
  109. </tr>
  110. </thead>
  111. <tbody>
  112. <tr>
  113. <td class="name"><code>next_call</code></td>
  114. <td class="type">
  115. <span class="param-type">InterceptingCall</span>
  116. |
  117. <span class="param-type">null</span>
  118. </td>
  119. <td class="attributes">
  120. </td>
  121. <td class="description last"><p>The next call in the chain</p></td>
  122. </tr>
  123. <tr>
  124. <td class="name"><code>requester</code></td>
  125. <td class="type">
  126. <span class="param-type"><a href="grpc.html#~Requester">grpc~Requester</a></span>
  127. </td>
  128. <td class="attributes">
  129. &lt;optional><br>
  130. </td>
  131. <td class="description last"><p>Interceptor methods to handle request
  132. operations.</p></td>
  133. </tr>
  134. </tbody>
  135. </table>
  136. <dl class="details">
  137. </dl>
  138. </dd>
  139. </div>
  140. <h3 class="subsection-title">Methods</h3>
  141. <dl>
  142. <hr>
  143. <dt>
  144. <h4 class="name" id="cancel"><span class="type-signature"></span>cancel()</h4>
  145. </dt>
  146. <dd>
  147. <div class="description">
  148. <p>Run a cancel operation through the interceptor chain</p>
  149. </div>
  150. <dl class="details">
  151. </dl>
  152. </dd>
  153. <hr>
  154. <dt>
  155. <h4 class="name" id="cancelWithStatus"><span class="type-signature"></span>cancelWithStatus(code, details)</h4>
  156. </dt>
  157. <dd>
  158. <div class="description">
  159. <p>Run a cancelWithStatus operation through the interceptor chain.</p>
  160. </div>
  161. <h5>Parameters:</h5>
  162. <table class="params table table-striped">
  163. <thead>
  164. <tr>
  165. <th>Name</th>
  166. <th>Type</th>
  167. <th class="last">Description</th>
  168. </tr>
  169. </thead>
  170. <tbody>
  171. <tr>
  172. <td class="name"><code>code</code></td>
  173. <td class="type">
  174. <span class="param-type">number</span>
  175. </td>
  176. <td class="description last"></td>
  177. </tr>
  178. <tr>
  179. <td class="name"><code>details</code></td>
  180. <td class="type">
  181. <span class="param-type">string</span>
  182. </td>
  183. <td class="description last"></td>
  184. </tr>
  185. </tbody>
  186. </table>
  187. <dl class="details">
  188. </dl>
  189. </dd>
  190. <hr>
  191. <dt>
  192. <h4 class="name" id="getPeer"><span class="type-signature"></span>getPeer()</h4>
  193. </dt>
  194. <dd>
  195. <div class="description">
  196. <p>Pass a getPeer call down to the base gRPC call (should not be intercepted)</p>
  197. </div>
  198. <dl class="details">
  199. </dl>
  200. <h5>Returns:</h5>
  201. <dl>
  202. <dt>
  203. Type
  204. </dt>
  205. <dd>
  206. <span class="param-type">object</span>
  207. </dd>
  208. </dl>
  209. </dd>
  210. <hr>
  211. <dt>
  212. <h4 class="name" id="halfClose"><span class="type-signature"></span>halfClose()</h4>
  213. </dt>
  214. <dd>
  215. <div class="description">
  216. <p>Run a close operation through the interceptor chain</p>
  217. </div>
  218. <dl class="details">
  219. </dl>
  220. </dd>
  221. <hr>
  222. <dt>
  223. <h4 class="name" id="recvMessageWithContext"><span class="type-signature"></span>recvMessageWithContext(context)</h4>
  224. </dt>
  225. <dd>
  226. <div class="description">
  227. <p>For receiving streaming messages, we need to seed the base interceptor with
  228. the streaming context to create a RECV_MESSAGE batch.</p>
  229. </div>
  230. <h5>Parameters:</h5>
  231. <table class="params table table-striped">
  232. <thead>
  233. <tr>
  234. <th>Name</th>
  235. <th>Type</th>
  236. <th class="last">Description</th>
  237. </tr>
  238. </thead>
  239. <tbody>
  240. <tr>
  241. <td class="name"><code>context</code></td>
  242. <td class="type">
  243. <span class="param-type">object</span>
  244. </td>
  245. <td class="description last"><p>Carries objects needed for streaming operations</p></td>
  246. </tr>
  247. </tbody>
  248. </table>
  249. <dl class="details">
  250. </dl>
  251. </dd>
  252. <hr>
  253. <dt>
  254. <h4 class="name" id="sendMessage"><span class="type-signature"></span>sendMessage(message)</h4>
  255. </dt>
  256. <dd>
  257. <div class="description">
  258. <p>Pass a message through the interceptor chain.</p>
  259. </div>
  260. <h5>Parameters:</h5>
  261. <table class="params table table-striped">
  262. <thead>
  263. <tr>
  264. <th>Name</th>
  265. <th>Type</th>
  266. <th class="last">Description</th>
  267. </tr>
  268. </thead>
  269. <tbody>
  270. <tr>
  271. <td class="name"><code>message</code></td>
  272. <td class="type">
  273. <span class="param-type">jspb.Message</span>
  274. </td>
  275. <td class="description last"></td>
  276. </tr>
  277. </tbody>
  278. </table>
  279. <dl class="details">
  280. </dl>
  281. </dd>
  282. <hr>
  283. <dt>
  284. <h4 class="name" id="sendMessageWithContext"><span class="type-signature"></span>sendMessageWithContext(context, message)</h4>
  285. </dt>
  286. <dd>
  287. <div class="description">
  288. <p>For streaming calls, we need to transparently pass the stream's context
  289. through the interceptor chain. Passes the context between InterceptingCalls
  290. but hides it from any requester implementations.</p>
  291. </div>
  292. <h5>Parameters:</h5>
  293. <table class="params table table-striped">
  294. <thead>
  295. <tr>
  296. <th>Name</th>
  297. <th>Type</th>
  298. <th class="last">Description</th>
  299. </tr>
  300. </thead>
  301. <tbody>
  302. <tr>
  303. <td class="name"><code>context</code></td>
  304. <td class="type">
  305. <span class="param-type">object</span>
  306. </td>
  307. <td class="description last"><p>Carries objects needed for streaming operations.</p></td>
  308. </tr>
  309. <tr>
  310. <td class="name"><code>message</code></td>
  311. <td class="type">
  312. <span class="param-type">jspb.Message</span>
  313. </td>
  314. <td class="description last"><p>The message to send.</p></td>
  315. </tr>
  316. </tbody>
  317. </table>
  318. <dl class="details">
  319. </dl>
  320. </dd>
  321. <hr>
  322. <dt>
  323. <h4 class="name" id="start"><span class="type-signature"></span>start(metadata, listener)</h4>
  324. </dt>
  325. <dd>
  326. <div class="description">
  327. <p>Starts a call through the outbound interceptor chain and adds an element to
  328. the reciprocal inbound listener chain.</p>
  329. </div>
  330. <h5>Parameters:</h5>
  331. <table class="params table table-striped">
  332. <thead>
  333. <tr>
  334. <th>Name</th>
  335. <th>Type</th>
  336. <th class="last">Description</th>
  337. </tr>
  338. </thead>
  339. <tbody>
  340. <tr>
  341. <td class="name"><code>metadata</code></td>
  342. <td class="type">
  343. <span class="param-type"><a href="grpc.Metadata.html">grpc.Metadata</a></span>
  344. </td>
  345. <td class="description last"><p>The outgoing metadata.</p></td>
  346. </tr>
  347. <tr>
  348. <td class="name"><code>listener</code></td>
  349. <td class="type">
  350. <span class="param-type"><a href="grpc.html#~Listener">grpc~Listener</a></span>
  351. </td>
  352. <td class="description last"><p>An intercepting listener for inbound
  353. operations.</p></td>
  354. </tr>
  355. </tbody>
  356. </table>
  357. <dl class="details">
  358. </dl>
  359. </dd>
  360. </dl>
  361. </article>
  362. </section>
  363. </div>
  364. </div>
  365. <div class="clearfix"></div>
  366. <div class="col-md-3">
  367. <div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div>
  368. </div>
  369. </div>
  370. </div>
  371. <div class="modal fade" id="searchResults">
  372. <div class="modal-dialog">
  373. <div class="modal-content">
  374. <div class="modal-header">
  375. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  376. <h4 class="modal-title">Search results</h4>
  377. </div>
  378. <div class="modal-body"></div>
  379. <div class="modal-footer">
  380. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  381. </div>
  382. </div><!-- /.modal-content -->
  383. </div><!-- /.modal-dialog -->
  384. </div>
  385. <footer>
  386. <span class="jsdoc-message">
  387. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
  388. on 2019-07-15T16:38:16-07:00
  389. using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
  390. </span>
  391. </footer>
  392. <script src="scripts/docstrap.lib.js"></script>
  393. <script src="scripts/toc.js"></script>
  394. <script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
  395. <script>
  396. $( function () {
  397. $( "[id*='$']" ).each( function () {
  398. var $this = $( this );
  399. $this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
  400. } );
  401. $( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () {
  402. var $this = $( this );
  403. var example = $this.find( "code" );
  404. exampleText = example.html();
  405. var lang = /{@lang (.*?)}/.exec( exampleText );
  406. if ( lang && lang[1] ) {
  407. exampleText = exampleText.replace( lang[0], "" );
  408. example.html( exampleText );
  409. lang = lang[1];
  410. } else {
  411. var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
  412. lang = langClassMatch ? langClassMatch[1] : "javascript";
  413. }
  414. if ( lang ) {
  415. $this
  416. .addClass( "sunlight-highlight-" + lang )
  417. .addClass( "linenums" )
  418. .html( example.html() );
  419. }
  420. } );
  421. Sunlight.highlightAll( {
  422. lineNumbers : false,
  423. showMenu : true,
  424. enableDoclinks : true
  425. } );
  426. $.catchAnchorLinks( {
  427. navbarOffset: 10
  428. } );
  429. $( "#toc" ).toc( {
  430. anchorName : function ( i, heading, prefix ) {
  431. return $( heading ).attr( "id" ) || ( prefix + i );
  432. },
  433. selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
  434. showAndHide : false,
  435. smoothScrolling: true
  436. } );
  437. $( "#main span[id^='toc']" ).addClass( "toc-shim" );
  438. $( '.dropdown-toggle' ).dropdown();
  439. $( "table" ).each( function () {
  440. var $this = $( this );
  441. $this.addClass('table');
  442. } );
  443. } );
  444. </script>
  445. <!--Navigation and Symbol Display-->
  446. <!--Google Analytics-->
  447. <script type="text/javascript">
  448. $(document).ready(function() {
  449. SearcherDisplay.init();
  450. });
  451. </script>
  452. </body>
  453. </html>