signalr-hub

Using Unity IoC to register and resolve SignalR hubs

廉价感情. 提交于 2019-11-30 19:22:17
I think I'm missing something very simple and maybe just need a new set of eyes. I have an ASP.NET MVC application. In that app, I am using Unity for my IoC to handle dependency injection. Each of my repositories need to have a database factory injected into it and each database factory needs to have a principal injected into it. So far, I've been utilizing the PerRequestLifetimeManager to register these. //Repositories container.RegisterType<ChatMessageRepository>(new PerRequestLifetimeManager()); container.RegisterType<SignalRConnectionRepository>(new PerRequestLifetimeManager()); //Context

The On event on the SignalR Client Hub does not get called

旧巷老猫 提交于 2019-11-30 11:17:06
I seem to have an issue with SignalR's JS Client Hub. The problem is that the 'on' handler does not seem to work - it generates no error but doesn't receive any signals sent by the server. The code below shows an extract where I call the server (using the invoke) which works fine - then on the server I call back to acceptHubData which should be picked up on the client but isn't. My objective is when navigating to pages that each page will open a connection to a specific hub and releases this connection when the user moves to another page!! EDIT : using the following code snippet works but I

SignalR client with multiple connections

*爱你&永不变心* 提交于 2019-11-30 10:26:46
问题 I have multiple SignalR 'services' running and only one UI to access them. How can I make the client js to talk to multiple connections with different Url? Because it seems I can only specify one url per $.connection.hub, and I can't use multiple 'signalr/hubs' client scripts. Any help? Thanks. 回答1: $.connection.hub is created in the /signalr/hubs inclusion. At the end of the file it essentially does: $.connection.hub = $.hubConnection("/signalr", { useDefaultPath: false }); To create the hub

SignalR - Checking if a user is still connected

走远了吗. 提交于 2019-11-30 08:59:10
I have a hub with method that is called client-side. This method launches a timer with a delegate that runs every 10 seconds. Since it wouldn't make sense to keep running this delegate if no one is connected to the hub, I want to check if any users are still connected from inside the delegate before I reschedule it. Is there any way to do this? cillierscharl Probably the most used solution is to keep a static variable containing users currently connected and overriding OnConnect and OnDisconnect or implementing IDisconnect depending on the version that you use. You would implement something

Signalr doesn't call client side functions

让人想犯罪 __ 提交于 2019-11-30 08:53:56
I'm using the VS2012 "Fall" Update with the Signalr 1.0.0 package. Calling server side functions works fine. However client functions are not called. Nothing seems to happen when onBroadcastMessage() (see below) is called. Questions: What am I missing? Is there a way to debug the client call? Thanks! Server code: using Microsoft.AspNet.SignalR; namespace KPMain { public class RealtimeConnectionHub : Hub { public void BroadcastMessage(string name, string message) { Clients.All.onBroadcastMessage(name, message); } } } Route registration: public class RouteConfig { public static void

SignalR: How to call .Net client method from server?

萝らか妹 提交于 2019-11-30 07:15:02
问题 I want to send data to my console application wich have a connection to my "someHub". I tried to do as described in example from a link but got no result. Server side code: [HubName("somehub")] public class SomeHub : Hub { public override Task OnConnected() { //Here I want to send "hello" on my sonsole application Clients.Caller.sendSomeData("hello"); return base.OnConnected(); } } Clien side code: public class Provider { protected HubConnection Connection; private IHubProxy _someHub; public

Using Unity IoC to register and resolve SignalR hubs

天涯浪子 提交于 2019-11-30 03:32:35
问题 I think I'm missing something very simple and maybe just need a new set of eyes. I have an ASP.NET MVC application. In that app, I am using Unity for my IoC to handle dependency injection. Each of my repositories need to have a database factory injected into it and each database factory needs to have a principal injected into it. So far, I've been utilizing the PerRequestLifetimeManager to register these. //Repositories container.RegisterType<ChatMessageRepository>(new

Call a hub method from a controller's action

无人久伴 提交于 2019-11-30 01:13:48
How can I call a hub method from a controller's action? What is the correct way of doing this? Someone used this in a post: DefaultHubManager hd = new DefaultHubManager(GlobalHost.DependencyResolver); var hub = hd.ResolveHub("AdminHub") as AdminHub; hub.SendMessage("woohoo"); But for me, that is throwing: Using a Hub instance not created by the HubPipeline is unsupported. I've read also that you can create a hub context, but I don't want to give the responsability to the action, that is, the action doing stuff like: hubContext.Client(...).someJsMethod(..) The correct way is to actually create

it is possible to stream video with SignalR?

大城市里の小女人 提交于 2019-11-29 23:05:20
Well I'm trying to perform a proof about video streaming, I'm working with asp.net c#. I'm kind of lost, you have any idea or suggestion? No, SignalR is based on standards (WebSockets, LongPolling, ForeverFrame, etc.) which only stream text based JSON messages. You're probably better off looking into the WebRTC specification . Now, you could bring these two technologies together by sending control messages with SignalR that triggers some JavaScript that changes the WebRTC feed that the browser is currently showing. I implemented video streaming on top of SignalR. You can find my example at

Group Chat Signal R with Web API

六月ゝ 毕业季﹏ 提交于 2019-11-29 16:52:37
Below i have three table which is used for GroupChat,Firstly I am creating the group its all data wil be inserted into GroupTable,then on success of groupCreation i am calling insertConnectionId function which will call the MapGroupConnectionId on backend which generate the SignalR connection ID and insert into GroupTable using groupId and groupCreaterId, its working fine and i have Group Friends Table which consist of Friends ID,Now when any friend sent message to particular Group, i need to send the Message to all who are in that Particular Group through SignalR, i thought, i ll assign the