Skip to content

Instantly share code, notes, and snippets.

@kstenson
Created July 26, 2012 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kstenson/3181163 to your computer and use it in GitHub Desktop.
Save kstenson/3181163 to your computer and use it in GitHub Desktop.
Clients is null
namespace MC.Bureau.Adaptation.Service
{
public class HealthMonitor :IWantToRunAtStartup
{
private string url = "http://localhost:8081/";
private Server _server;
private HealthMonitorHub _healthMonitor;
public ITransport Transport { get; set; }
public void Run()
{
Transport.TransportMessageReceived += OnTransportMessageReceived;
_server = new Server(url);
_healthMonitor = new HealthMonitorHub();
_server
.MapHubs();
_server.Start();
}
public void Stop()
{
throw new NotImplementedException();
}
private void OnTransportMessageReceived(object sender, TransportMessageReceivedEventArgs EventArgs)
{
_healthMonitor.Send(Encoding.Default.GetString(EventArgs.Message.Body));
}
}
public class HealthMonitorHub: Hub
{
public void Send(string message)
{
Clients.SendMessage(message);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment