< default.aspx -------------- when i run the code vs2010 .net framework 4.0 default web page display but the append message is not getting when i click send button whats wrong in this coding html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>SignalR</title> <script src="Scripts/jquery-1.6.2.min.js" type="text/javascript"></script> <script type="text/javascript" src="Scripts/jquery.signalR-0.5.3.min.js"> </script> <script src="/signalr/hubs" type="text/javascript"></script> <script type="text/javascript"> $(function () { var chat = $.connection.chat; alert("connection"); chat.client.addMessage = function (message) { $('#messages').append($('<li>'+message+'</li>'))}; $("#broadcast").click(function () { chat.server.send($('#msg').val()); alert("broadcast"); }); $.connection.hub.start(); }); </script> </head> <body> <form id="form1" runat="server"> <div> <h2>SignalR</h2> <input type="text" id="msg"/> <input type="button" id="broadcast" value="Send" /> <br /> <br /> <ul id="messages"></ul> </div> </form> </body> </html>
chat.cs ------- <pre lang="cs">using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Routing; using Microsoft.AspNet.SignalR.Hubs; using Microsoft.AspNet.SignalR; using Microsoft.SqlServer.Server; using System.Data.SqlClient; /// <summary> /// Summary description for chat /// </summary> public class chat:Hub { public void send (string message) { Clients.All.addMessgae(message); }</pre>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)