Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move SignalR Hubs to Another Project

I want to know is it possible to put SignalR's Hub(s) in a different project than Asp.Net project? If it's yes. How can I access to a Hub classes?

Thanks in advance.

like image 750
saber Avatar asked Nov 13 '13 17:11

saber


Video Answer


1 Answers

As far as I am aware, it is not possible to put a SignalR Hub in anything other than an ASP.NET project, seeing that SignalR is built on the ASP.NET framework, and lives within the ASP.NET namespace. I have not found anything to say anything to the contrary.

However, since Hubs do not need to be in the same project to be accessible for clients, any .NET or Java-Script client can connect to the Hub with the proper amount of configuration.

This link explains how a JavaScript client works: http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-javascript-client

If your not using a .NET client to connect, but, say, an external website, tone-in to the Cross-Site Reference section: http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-javascript-client#crossdomain

This links explains how a .NET Client such as a Windows Store App, Silverlight, WPF, and console applications work: http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-net-client#clientsetup

Seeing as your trying to access a hub in a separate project, which isn't ASP.NET, I would suspect your using a .NET client of some form. The prior link explains how to configure those connections.

So, for example, if your building an .NET client, such as a Windows Store App, it can still access the SignalR Hub located in a ASP.NET project when published, allowing for any real-time functions to work in the client just as it would if the client was within the same ASP.NET project.

like image 142
James Haug Avatar answered Oct 13 '22 03:10

James Haug