New MVC Project
If there is no signale need to use NuGet installation SIGNALR
namespace signalrdemo{ publicclass chathub:hub { publicvoid Send (string name,string message) { Clients.All.broadcastMessage (name, message); }}}
"Viewport"Content="Width=device-width"/> <title> Temporary chat tools </title> <script src="~/scripts/jquery-1.10.2.js"></script> <script src="~/scripts/jquery.signalr-2.0.0.js"></script> <script src="signalr/hubs"Type="Text/javascript"></script> <script type="Text/javascript">$ (function () {//define a proxy to refer to the Hub varChat =$.connection.chathub; //The hub class on the server calls this function to push the content and update to each client "receive messages from the background, and then add them to the panel"Chat.client.broadcastMessage =function (name, message) {varEncodedname = $ ('<div/>'). Text (name). HTML (); varEncodedmsg = $ ('<div/>'). Text (message). HTML (); $('#discussion'). Append ('<li><strong>'+Encodedname+'</strong>: '+ encodedmsg +'</li>'); }; //Enter a name$('#displayname'). Val (Prompt ('Please enter your name:',"')); $('#message'). focus (); //Open Link$.connection.hub.start (). Done (function () {$ ('#sendmessage'). Click (function () {//calling the Send method in the hubChat.server.send ($ ('#displayname'). Val (), $ ('#message'). Val ()); $('#message'). Val ("'). focus (); }); }); }); </script> <style type="Text/css">. Container {background-Color:yellowgreen; Border:thick solid #0000ff; padding:20px; margin:20px; } </style>class="Container"> <input type="text"Id="message"/> <input type="Button"Id="SendMessage"Value="Send"/> <input type="Hidden"Id="DisplayName"/> <ul id="discussion"></ul> </div></body>SIGNALR Communication Technology