Skip to content

Instantly share code, notes, and snippets.

@DanielSSilva
Last active October 10, 2017 16:34
Show Gist options
  • Save DanielSSilva/33d7befb547c38ce7e0942ba58f219b9 to your computer and use it in GitHub Desktop.
Save DanielSSilva/33d7befb547c38ce7e0942ba58f219b9 to your computer and use it in GitHub Desktop.
SignalR sample
HubConnection connection = new HubConnectionBuilder()
.WithUrl("http://localhost:52846/entryPoint")
.WithConsoleLogger()
.Build();
connection.StartAsync().GetAwaiter().GetResult();
connection.InvokeAsync("RegisterConnectionOnGroup", "CoolEmployees");
int myNumber = r.Next(0, 1000); // just to ensure that we have different clients
connection.On<string>("ClientMethod", data => Console.WriteLine($"I'm CoolEmployee with random number = {myNumber} - GOT THIS: {data}"));
while (true) ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment