{"id":284,"date":"2020-05-15T14:16:06","date_gmt":"2020-05-15T14:16:06","guid":{"rendered":"https:\/\/startersites.io\/blocksy\/app\/?p=284"},"modified":"2025-01-05T14:26:41","modified_gmt":"2025-01-05T14:26:41","slug":"steps-to-test-grpc-server-streaming-methods","status":"publish","type":"post","link":"https:\/\/fintx.dev\/?p=284","title":{"rendered":"Testing gRPC Server Streaming Methods"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Before we start<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">First thing we need to create a gRPC service that has a server streaming method.  For this tutorial, we will run the gRPC service found at <a href=\"https:\/\/github.com\/namigop\/grpctutorials\/tree\/main\/ServerStreaming\">https:\/\/github.com\/namigop\/grpctutorials\/tree\/main\/ServerStreaming<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This service has the following server streaming method<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"rpc GetNotifications(GetNotificationsRequest) returns (stream GetNotificationsResponse);\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9\">rpc<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">GetNotifications<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">GetNotificationsRequest<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #88C0D0\">returns<\/span><span style=\"color: #D8DEE9FF\"> (<\/span><span style=\"color: #D8DEE9\">stream<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">GetNotificationsResponse<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Test the service<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Start the gRPC service <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Start FintX then click on the plus icon to add a client. The value entered in the http address should match the running service<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/grpctutorials.net\/wp-content\/uploads\/2024\/01\/AddClient-1.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Click Okay<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once the gRPC lclient is created and displayed int he UI, double-click on the method to open it in the tab.  Alternatively, you can also click the <img decoding=\"async\" width=\"27\" height=\"27\" class=\"wp-image-2511\" style=\"width: 27px;\" src=\"https:\/\/fintx.dev\/wp-content\/uploads\/2020\/05\/image.png\" alt=\"\"> &#8220;Create Request Button&#8221; to create request file that is saved on disk<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the screenshow below, 2 request *.fxrq) files created created under the Server Streaming method <strong>GetNotifications<\/strong>.  Double on one of the request files to open it in the tab<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Click the Run button <img decoding=\"async\" width=\"30\" height=\"30\" class=\"wp-image-2513\" style=\"width: 30px;\" src=\"https:\/\/fintx.dev\/wp-content\/uploads\/2020\/05\/image-1.png\" alt=\"\"><\/p>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;6a1438152d131&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"6a1438152d131\" class=\"wp-block-image size-large wp-lightbox-container\"><img decoding=\"async\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on--pointerdown=\"actions.preloadImage\" data-wp-on--pointerenter=\"actions.preloadImageWithDelay\" data-wp-on--pointerleave=\"actions.cancelPreload\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/grpctutorials.net\/wp-content\/uploads\/2024\/01\/ServerStreamingCall.png\" alt=\"\"\/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\tdata-wp-bind--aria-label=\"state.thisImage.triggerButtonAriaLabel\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.thisImage.buttonRight\"\n\t\t\tdata-wp-style--top=\"state.thisImage.buttonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The server stream will show in the lower-right panel.  Once the server is fnished streaming, the final response will be shown on the upper-right panel (above the server stream)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Before we start First thing we need to create a gRPC service that has a server streaming method. For this tutorial, we will run the gRPC service found at https:\/\/github.com\/namigop\/grpctutorials\/tree\/main\/ServerStreaming This service has the following server streaming method Test the service Start the gRPC service Start FintX then click on the plus icon to add [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[42],"tags":[],"class_list":["post-284","post","type-post","status-publish","format-standard","hentry","category-client-testing"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[]}},"_links":{"self":[{"href":"https:\/\/fintx.dev\/index.php?rest_route=\/wp\/v2\/posts\/284","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fintx.dev\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fintx.dev\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fintx.dev\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fintx.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=284"}],"version-history":[{"count":5,"href":"https:\/\/fintx.dev\/index.php?rest_route=\/wp\/v2\/posts\/284\/revisions"}],"predecessor-version":[{"id":2519,"href":"https:\/\/fintx.dev\/index.php?rest_route=\/wp\/v2\/posts\/284\/revisions\/2519"}],"wp:attachment":[{"href":"https:\/\/fintx.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fintx.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fintx.dev\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}