Skip to content

Instantly share code, notes, and snippets.

@bsimser
Created May 26, 2012 02:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsimser/2791751 to your computer and use it in GitHub Desktop.
Save bsimser/2791751 to your computer and use it in GitHub Desktop.
.NET console app SignalR client
using System;
using SignalR.Client.Hubs;
namespace FANS.Demo
{
internal class Program
{
private static void Main(string[] args)
{
try
{
var connection = new HubConnection("http://localhost:666/");
IHubProxy hub = connection.CreateProxy("NotificationHub");
connection.Start().ContinueWith(
task =>
{
if (task.IsFaulted)
{
Console.WriteLine("{0}", task.Exception.GetBaseException());
}
else
{
hub.Invoke("SendMessage", "Hello").ContinueWith(
message =>
{
Console.WriteLine("{0}", message.Status);
});
}
});
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment