{"id":117,"date":"2006-05-16T11:11:33","date_gmt":"2006-05-16T18:11:33","guid":{"rendered":"http:\/\/kennyw.com\/indigo\/117"},"modified":"2006-05-16T11:11:33","modified_gmt":"2006-05-16T18:11:33","slug":"building-a-client-side-listener","status":"publish","type":"post","link":"https:\/\/kennyw.com\/?p=117","title":{"rendered":"Building a &quot;client-side&quot; Listener"},"content":{"rendered":"<p>I wrote earlier about how to <a href=\"http:\/\/kennyw.com\/indigo\/104\">write a Service that listens on any free port<\/a>.  If you are programming at the Channel\/Binding layer directly, the easiest way to autogenerate a ListenUri is to call the following method on your Binding:<\/p>\n<div class=\"indent1\">\n<code class=\"keyword\">public<\/code> <code class=\"classname\">IChannelListener<\/code><code>&lt;TChannel&gt; BuildChannelListener&lt;TChannel&gt;(<\/code><code class=\"keyword\">params object<\/code><code>[] parameters)<\/code><\/div>\n<p>For example: <code>myListener = myBinding.BuildChannelListener&lt;<\/code><code class=\"classname\">IInputChannel<\/code><code>&gt;();<\/code><\/p>\n<p>The base class will expand this call out to create a Listener using the scheme from the binding, the hostname of the machine, and <a href=\"http:\/\/kennyw.com\/indigo\/104\"><code class=\"classname\">ListenUriMode<\/code><code>.Unique<\/code><\/a> to generate the rest of the ListenUri:<\/p>\n<div class=\"code\">\n<div class=\"indent1\">\n<code class=\"classname\">UriBuilder<\/code> listenUriBuilder = new <code class=\"classname\">UriBuilder<\/code>(<code class=\"keyword\">this<\/code>.Scheme, machineName);<\/p>\n<p>return <code class=\"keyword\">this<\/code>.BuildChannelListener&lt;TChannel&gt;(listenUriBuilder.Uri, <code class=\"keyword\">string<\/code>.Empty, <code class=\"classname\">ListenUriMode<\/code>.Unique, parameters);\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I wrote earlier about how to write a Service that listens on any free port. If you are programming at the Channel\/Binding layer directly, the easiest way to autogenerate a ListenUri is to call the following method on your Binding: public IChannelListener&lt;TChannel&gt; BuildChannelListener&lt;TChannel&gt;(params object[] parameters) For example: myListener = myBinding.BuildChannelListener&lt;IInputChannel&gt;(); The base class will expand [&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-117","post","type-post","status-publish","format-standard","hentry","category-indigo"],"_links":{"self":[{"href":"https:\/\/kennyw.com\/index.php?rest_route=\/wp\/v2\/posts\/117","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=117"}],"version-history":[{"count":0,"href":"https:\/\/kennyw.com\/index.php?rest_route=\/wp\/v2\/posts\/117\/revisions"}],"wp:attachment":[{"href":"https:\/\/kennyw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kennyw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kennyw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}