Exemplo n.º 1
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     _client = new SignalR.Client.Client(new System.Uri(Uri));
     _client.OnMessage += (se, ev) =>
         Application.Current.Dispatcher.BeginInvoke(
             DispatcherPriority.Normal,
             new Action(() =>
             {
                 Messages.Text += string.Format("\n{0}", ev.Value);
             }));
     var connected = _client.Connect(SignalR.Client.Enums.TransportType.ServerSentEvents);
     Messages.Text = string.Format("Connected: {0}", connected);
 }
Exemplo n.º 2
0
        public void Run()
        {
            var uri = new Uri("http://localhost:8080");
            using (var client = new SignalR.Client.Client(uri))
            {
                client.OnMessage += client_OnMessage;

                try
                {
                    client.Connect();
                    System.Console.ReadLine();
                }
                catch (Exception e)
                {
                    System.Console.WriteLine("Exception {0}", e.Message);
                }
            }
        }