The github page shows how to do this using PersistentConnections.
public class MyConnection : PersistentConnection {
protected override Task OnReceivedAsync(string clientId, string data) {
// Broadcast data to all clients
return Connection.Broadcast(data);
}
}
Global.asax
using System;
using System.Web.Routing;
using SignalR.Routing;
public class Global : System.Web.HttpApplication {
protected void Application_Start(object sender, EventArgs e) {
// Register the route for chat
RouteTable.Routes.MapConnection<MyConnection>("echo", "echo/{*operation}");
}
}
Then on the client:
$(function () {
var connection = $.connection( echo );
connection.received(function (data) {
$( #messages ).append( <li> + data + </li> );
});
connection.start();
$("#broadcast").click(function () {
connection.send($( #msg ).val());
});
});