Exemplo n.º 1
0
        static void Main(string[] args)
        {
            //Connect to xsockets windows service (installed from https://chocolatey.org/packages/XSockets.Windows.Service/)
            var c = new XSocketClient("ws://127.0.0.1:4509/Generic", "http://*");

            AsyncContext.Run(async() =>
            {
                await c.Bind("foo", textArgs => Console.WriteLine("foo {0}", textArgs.data));
                c.OnOpen  += (sender, eventArgs) => Console.WriteLine("OPEN");
                c.OnClose += (sender, eventArgs) => Console.WriteLine("CLOSED");
                await c.Open();

                Console.ReadLine();

                await c.Send("Bar", "foo");

                Console.ReadLine();
            });
        }
Exemplo n.º 2
0
 static void Send(string json)
 {
     client.Send(new TextArgs(json, "data"));
 }
Exemplo n.º 3
0
 public static void SetServerProperty(this XSocketClient client, string propertyName, object value)
 {
     client.Send(new { value = value }, "set_" + propertyName);
 }
Exemplo n.º 4
0
 void Send(string message)
 {
     client.Send(new TextArgs(message, "data"));
 }