Created
July 26, 2012 09:17
-
-
Save kstenson/3181163 to your computer and use it in GitHub Desktop.
Clients is null
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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