2.2.3.Connecting to the hub

  • 1.Add New Item -> html

  • 2.Edit html file:

      <!DOCTYPE html>
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
          <title></title>
          <script src="Scripts/jquery-1.6.4.js"></script>
          <script src="Scripts/jquery.signalR-2.2.2.js"></script>
          <script src="../signalr/hubs" type = "text/javascript"></script>
      </head>
      <body>
          <script>
              $.connection.hub.start().done(function () {
                  alert("connected")
              }).fail(function () {
                  alert("no connected")
              });
          </script>
      </body>
      </html>

Last updated