Created
October 28, 2013 18:29
-
-
Save XSockets/7202051 to your computer and use it in GitHub Desktop.
A simple demo of howto configure clusters in XSockets 3.0
This file contains hidden or 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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var wss = Composable.GetExport<IXSocketServerContainer>(); | |
//These are my siblings on the same server but other ports | |
//This is all that's needed to enable cluster-functionality | |
wss.Siblings.Add("ws://127.0.0.1:4506"); | |
wss.Siblings.Add("ws://127.0.0.1:4507"); | |
//We can start one server on several IP:PORT but settle for one here... | |
var customConfig = new List<IConfigurationSetting>() {new ConfigurationSetting("ws://127.0.0.1:4505")}; | |
wss.StartServers(withInterceptors: Debugger.IsAttached, configurationSettings: customConfig); | |
//Display connection info | |
foreach (var server in wss.Servers) | |
{ | |
Console.WriteLine("Started Server: {0}:{1}", server.ConfigurationSetting.Location, server.ConfigurationSetting.Port); | |
Console.WriteLine("Scheme: {0}", server.ConfigurationSetting.Scheme); | |
Console.WriteLine("SSL/TLS: {0}", server.ConfigurationSetting.IsSecure); | |
Console.WriteLine("Allowed Connections (0 = infinite): {0}", server.ConfigurationSetting.NumberOfAllowedConections); | |
Console.WriteLine(); | |
} | |
Console.WriteLine("Hit enter to quit..."); | |
Console.ReadLine(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment