SignalR - ASP.net required for the client?

2019-08-04 04:55发布

问题:

I am trying to figure out if ASP.net on the client side in order to support SignalR. I would rather not be reliant on asp.net if at all possible for the webclient. I haven't found anything thus far that leads me to believe that it is required, but I could be overlooking something obvious.

EDIT: As noted by the comments my question was not correct. I am ultimately trying to find out if ASP.net is required to use SignalR. From Lain's comments below it doesn't sound like it is which is excellent!

Any information would be greatly appreciated.

回答1:

No. ASP.Net isn't required on either the client or the server side.

ASP.Net is a server-side platform for .Net, so can't be used as part of a client.

There is a native C# / .Net client, but this is lightweight and does not require any http server platforms.

The server side or 'Hub' can be process self-hosted, or hooked into an existing IIS site. It does not use ASP.net directly, but can work side-by-side with an ASP.Net website.

You will need a hub running to connect to for your client.

For more information, see the SignalR project site, which has examples: http://signalr.net/




回答2:

SignalR is a libbrary build for asp.net that employs features like web sockets, long polling, forever frames. If you want to distant your self from asp.net you could implement any of these features with any server side language (directly not through signalR).

But for specifically using signalR without asp.net (although may be doable) is something I would prefer not to try or suggest. All that for the server side.

For client side simple javascript would suffice, so you do not need to use any microsoft technology there.



回答3:

No ASP.NET is required for SignalR.

You'll need to have a class that Implements IHub and that class has to be in C# or VB which is obviously a language of .Net framework.

Also, the hub javascript file is outputted by signalr using c#

And any framework will be proud to announce itself platform agnostic, and signalr's home page's title itself mentions ASP.NET SignalR So defenitely you are going to need .Net.

And you need to have this RouteTable.Routes.MapConnection<MyConnection>(...); which is obviously c# in Global.asax, which is obviously executed only by a asp.net website.

And last but not the least, SignalR is implemented in C# and you need ASP.Net so that signalr executes c# in runtime.

That's a lot of reason, why you should definitely have asp.net :)