public static void Start() { Config.Initialize(new Config.ConfigParams() { ConnectionProvider = new WebSocketConnectionProvider() { FragmentLength = (512 * 1024) - 14 } // use 512kb for a single frame }); _objClient = new Mitto.Client(); ReceiveOnChannelRequestAction.ChannelMessageReceived += ReceiveOnChannel_ChannelMessageReceived; _objClient.Connected += delegate(object sender, Mitto.Client pClient) { Console.WriteLine("Client Connected"); //StartSending(); StartReceiving(); }; _objClient.ConnectAsync(new ClientParams() { //Hostname = "192.168.0.111", // -- ubuntu server Hostname = "192.168.0.105", // -- desktop Port = 8080, Secure = false, MaxBytePerSecond = 1000 * 1000 * 1 // -- bytes - kilobyte - megabyte }); }
private static void Main(string[] args) { //Initialize using the default config Config.Initialize(); //When a message is received, display it on the console ReceiveOnChannelRequestAction.ChannelMessageReceived += delegate(string pChannel, string pMessage) { Console.WriteLine($"{pChannel} > {pMessage}"); }; //Establish a connection and subscribe to the "MyChannel" _objClient = new Mitto.Client(); _objClient.Connected += delegate(object sender, Mitto.Client pClient) { Console.WriteLine("Client Connected"); _objClient.Request <ACKResponse>( new ChannelSubscribe("MyChannel"), r => { if (r.Status.State == ResponseState.Success) { Start(); } else { Console.WriteLine("Failed Subscribing to Channel"); } } ); }; _objClient.ConnectAsync(new ClientParams() { Hostname = "localhost", Port = 8080, Secure = false }); Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) { _quit.Set(); }; _quit.WaitOne(); }