-
Notifications
You must be signed in to change notification settings - Fork 6
How To
Tommaso Bertoni edited this page Dec 23, 2016
·
6 revisions
IrisServer server = new IrisServer();
server.Start(2200); // Start on port 2200
// If you have a server and you want to use the same subscription network
IrisServerConfig config = server.GetServerConfig();
// If you just want to communicate locally or on a different local network
IrisServerConfig config = new IrisServerConfig(new IrisPubSubRouter());
IrisServerLocalNode node = new IrisServerLocalNode();
node.Connect(config);
IrisClientConfig config = new IrisClientConfig() { Hostname = "127.0.0.1", Port = 2200 };
IrisClientNode node = new IrisClientNode();
node.Connect(config);
IDisposableSubscription subscription = node.Subscribe("worldnews", MyContentHandler);
node.Send("worldnews", "something good happened");
// If you have a reference to the IDisposableSubscription returned by the
// Subscribe method you can simply write
subscription.Dispose();
// Otherwise you can use the Unsubscribe method
node.Unsubscribe("worldnews", MyContentHandler);
For more examples and use cases head over to the Iris.NET.Demo project.