{"id":191,"date":"2007-08-23T12:30:02","date_gmt":"2007-08-23T19:30:02","guid":{"rendered":"http:\/\/kennyw.com\/indigo\/191"},"modified":"2007-08-23T12:30:02","modified_gmt":"2007-08-23T19:30:02","slug":"signalling-end-of-session","status":"publish","type":"post","link":"https:\/\/kennyw.com\/?p=191","title":{"rendered":"Signalling &quot;End Of Session&quot;"},"content":{"rendered":"<p>When authoring a session-ful channel, it&#8217;s important to signal &#8220;end of session&#8221; correctly so that the runtime (or any other user of the channel) knows when to stop reading messages, and to start <a href=\"http:\/\/kennyw.com\/indigo\/87\">shutting down his side of the conversation<\/a> (with CloseOutputSession and\/or channel.Close). A <code class=\"keyword\">null<\/code> Message\/RequestContext signals end-of-session to the caller. In particular, depending on your channel shape, you should do the following:<\/p>\n<ul>\n<li><strong>IInputSessionChannel\/IDuplexSessionChannel<\/strong>:  Return <code class=\"keyword\">null<\/code> from channel.Receive(). Correspondingly, return <code class=\"keyword\">true<\/code> from TryReceive with the &#8220;message&#8221; out-param set to <code class=\"keyword\">null<\/code>. And of course, cover your bases by having BeginTryReceive complete synchronously with a signal to return <code class=\"keyword\">true<\/code> + message = <code class=\"keyword\">null<\/code> from EndTryReceive.<\/li>\n<li><strong>IRequestSessionChannel<\/strong>:  Return <code class=\"keyword\">null<\/code> from channel.ReceiveRequest(). Correspondingly, return <code class=\"keyword\">true<\/code> from TryReceiveRequest with the &#8220;context&#8221; out-param set to <code class=\"keyword\">null<\/code>. Lastly, have BeginTryReceiveRequest complete synchronously with a signal to return <code class=\"keyword\">true<\/code> + context = <code class=\"keyword\">null<\/code> from EndTryReceiveRequest.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>When authoring a session-ful channel, it&#8217;s important to signal &#8220;end of session&#8221; correctly so that the runtime (or any other user of the channel) knows when to stop reading messages, and to start shutting down his side of the conversation (with CloseOutputSession and\/or channel.Close). A null Message\/RequestContext signals end-of-session to the caller. In particular, depending [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-191","post","type-post","status-publish","format-standard","hentry","category-indigo"],"_links":{"self":[{"href":"https:\/\/kennyw.com\/index.php?rest_route=\/wp\/v2\/posts\/191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kennyw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kennyw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kennyw.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kennyw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=191"}],"version-history":[{"count":0,"href":"https:\/\/kennyw.com\/index.php?rest_route=\/wp\/v2\/posts\/191\/revisions"}],"wp:attachment":[{"href":"https:\/\/kennyw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kennyw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kennyw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}