문제

I am kind of a noob when it comes to SignalR. Just started poking around and googling about it, and I was wondering if anyone could explain to me some differences between things are done.

In some of the examples I've seen, people needed to make a Startup class and define app.MapSignalR(); and in some applications I can't seem to find that piece of code, but it looks like they defined the signalr route with

outeTable.Routes.MapHubs(new HubConfiguration());

So could anybody tell me the difference? When should I use one over the other?

I was also wondering about the difference between using $.connection.someHubName and var connection = $.hubConnection(); connection.createHubyProxy(someHubName);?

I do realize that the first is some auto-generated proxy, but what does that mean and when should I use one over the other?

도움이 되었습니까?

해결책

RouteTable.Routes.MapHubs(new HubConfiguration()) is simply the old way of mapping SignalR, and is, as far as I know, deprecated. Stick to app.MapSignalR(); in your Startup class.

As for your other question, you do the first thing in javascript if you'd like a generated proxy, and the other if you don't. More information: http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-javascript-client#genproxy

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top