Skip to content

Instantly share code, notes, and snippets.

@thecopy
Last active August 29, 2015 14:01
Show Gist options
  • Save thecopy/19a474b6d26d527999e8 to your computer and use it in GitHub Desktop.
Save thecopy/19a474b6d26d527999e8 to your computer and use it in GitHub Desktop.
using System;
using Microsoft.AspNet.SignalR;
using Microsoft.Owin.Hosting;
using Owin;
namespace SignalRSelfHost
{
class Program
{
static void Main(string[] args)
{
// This will *ONLY* bind to localhost, if you want to bind to all addresses
// use http://*:8080 to bind to all addresses.
// See http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx
// for more information.
string url = "http://localhost:8080";
using (WebApp.Start(url))
{
Console.WriteLine("Server running on {0}", url);
Console.ReadLine();
}
}
}
class Startup
{
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
public class MyHub : Hub
{
public void SomeFunction(MemberInformation member)
{
Clients.All.functionOneClient(new MemeberInformation("hehe", member.LastName));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment