Update - The bugs addressed in this article are not present in .net core 1.0! Will update more later.

I wanted to try SignalR with .NET Core RC2, but according to the .NET Core Roadmap, it isn't officially supported yet. Let's try it anyway. (TLDR - I do get it working, but only sending to all clients, so far)

First, add the nuget packages. If you don't already have it in there, add the aspnetmaster nuget package source first.

Then add to your project.json:

"Microsoft.AspNetCore.SignalR.Server": "0.1.0-rc2-final",
"Microsoft.AspNetCore.WebSockets.Server": "0.1.0-*"

Then make a simple hub...

using Microsoft.AspNetCore.SignalR;
using Microsoft.AspNetCore.SignalR.Hubs;

namespace TestProject.Hubs {
	public class TestHub : Hub {

Then use it somewhere... for example, this controller's Index action would call hello("World") on all connected clients.

using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Microsoft.AspNetCore.SignalR.Infrastructure;
using TestProject.Hubs;

namespace TestProject.Controllers {
	public class HomeController : Controller {
		private readonly IHubContext _hub;

		public HomeController(IConnectionManager connectionManager) {
			_hub = connectionManager.GetHubContext<TestHub>();

		public IActionResult Index() {
			return View();

Then set up a view that included the MS jQuery SignalR client, and /signalr/hubs. If you haven't done this before, read more on the Microsoft jQuery SignalR client here

<script src="/scripts/jquery.signalR-2.1.0.min.js"></script>
<script src="~/signalr/hubs"></script>

Neato, that should work, right?

No. It should, but it doesn't. Open your console, and you'll see a javascript error saying the hub is undefined / not found / something along those lines (I forget).

If you hit /signalr/hubs, you'll notice that it doesn't actually have any hubs configured. Why's that? Because SignalR is broken and doesn't load any hubs from your own project's assembly. A few people figured it out in this GitHub issue.

Two ways to fix it...

  1. Add https://www.myget.org/F/codecomb-rc2/api/v3/index.json nuget package source, and let it replace the aspnetmaster version of the SignalR package.
  2. Or make your own IAssemblyLocator and set it into IoC.
    using Microsoft.AspNetCore.SignalR.Hubs;
    using System.Reflection;
    using System.Collections.Generic;
    namespace TestProject.Services {
    	public class CurrentAssemblyLocator : IAssemblyLocator {
    		public IList<Assembly> GetAssemblies() {
    			return new[] { Assembly.GetEntryAssembly() };
    Then in Startup.ConfigureServices...
    services.AddSingleton<IAssemblyLocator, CurrentAssemblyLocator>();

Both routes work, hopefully neither will be necessary soon. I opted for the nuget package once I saw someone had done that, as that at least won't involve code changes, just removing a package source.

That should get you started at least. I'm still having problems trying to get [Authorize] working on Hubs, but it's not enough of a priority to figure out yet. If anyone else has gotten [Authorize] and sending to individual clients by Id / Username / whatever, please let me know!