title: Display SignalR message with embedded HTML
body: <p>I've begun playing around with SignalR, of course starting with the initial chat hub that I suppose everybody does at one point or another.  I want to modify it so that if the user types in HTML in their message, when it gets displayed it shows rendered HTML as oppose to just the string with HTML tags in it.</p>
  
  <p>Here is my javascript:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(function () {
      var chat = $.connection.chatHub;
      chat.client.broadcastMessage = function (name, message) {
          var encodedName = $('&lt;div /&gt;').text(name).html();
          var encodedMesg = $('&lt;div /&gt;').text(message).html();
  
          if (message === "joined session") {
              $('#discussion').append('&lt;li&gt;&lt;strong&gt;' + encodedName + ' ' + encodedMesg + '&lt;/strong&gt;&lt;/li&gt;');
          } else {
              $('#discussion').append('&lt;li&gt;&lt;strong&gt;' + encodedName + '&lt;/strong&gt;:&amp;nbsp;&amp;nbsp' + encodedMesg + '&lt;/li&gt;');
          }
      };
  
      $('#message').focus();
  
      $.connection.hub.start().done(function () {
          chat.server.send("@FullName", "joined session");
  
          $('#sendmessage').click(function () {
              chat.server.send("@FullName", $('#message').val());
              $('#message').val("").focus();
          });
      });
  });
  </code></pre>
  
  <p></p>
  
  <p>The encodedMesg has "this is &lt;b&gt;bold&lt;/b&gt;", but instead of rendering it as HTML, it just shows it as a string.  How can I allow this to render as HTML?</p>
  
  <p>I've tried encoding the &lt; as &amp;lt; and > as &amp;gt; but that didn;t work.  I also tried %3C and %3E but they didn;t work either.</p>