signalr-hub

Call a hub method from a controller's action

↘锁芯ラ 提交于 2019-12-18 10:59:32
问题 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

it is possible to stream video with SignalR?

旧街凉风 提交于 2019-12-18 10:37:12
问题 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? 回答1: 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

Group Chat Signal R with Web API

杀马特。学长 韩版系。学妹 提交于 2019-12-18 09:39:11
问题 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

Progress report using SignalR and IProgress interface

喜你入骨 提交于 2019-12-17 20:01:03
问题 I have a Hub class, which has a long running method, I need to display a progress bar while it's working. I read this article and I think it is possible to use IProgress interface in async methods to send long running operation status. I write a method like this: public async Task<string> GetServerTime(IProgress<int> prog) { await Task.Run(() => { for (int i = 0; i < 10; i++) { prog.Report(i * 10); System.Threading.Thread.Sleep(200); } }); return DateTime.Now.ToString(); } And I try to invoke

How to connect Hub if Hub is in different project SignalR?

a 夏天 提交于 2019-12-14 03:59:18
问题 I'm working with SignalR project, in which I want to use Hub in WebApi project as well as Web project. So I've created one class library project and implemented Hub over there. My project structure looks like: -ChatHub -Hub -Webapi -Website Here is my Hub: [HubName("chathub")] public class ChatHub : Hub { public override Task OnConnected() { return base.OnConnected(); } public override Task OnReconnected() { return base.OnReconnected(); } } When I calling Hub from my website it's working well

Cannot read property 'chatHub' of undefined SignalR Hub

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-14 02:22:18
问题 i'm try to learn signalr and this error i'm founded it. Cannot read property 'chatHub' of undefined. $(document).ready(function () { var chat = $.connection.chatHub; $.connection.hub.start(); }); and hub file is: namespace TestSignalR.Web.Hubs { public class ChatHub : Microsoft.AspNet.SignalR.Hub { public void Send(string msg) { ChatData chat = new ChatData(); chat.Msg = msg; chat.UserName = HttpContext.Current.User.Identity.Name; chat.Date = "♣ at " + DateTime.Now.ToString("hh:mm tt");

Authorization in SignalR 2.0

纵饮孤独 提交于 2019-12-13 19:09:59
问题 I have a Web server with forms authentication and another server that hosts the SignalR Hubs. Using the forms authentication cookie I want to extract the current user using the code below. This would be possible using a HttpModule, but when using SignalR a HttpModule cannot be used. Is there any other way to archive what I want to do? public class AuthorizationHubModule : HubPipelineModule { public AuthorizationHubModule() { } protected override bool OnBeforeConnect(IHub hub) { var cookies =

Unable to implement p2p chat using SignalR in Android

时光怂恿深爱的人放手 提交于 2019-12-13 14:17:53
问题 I have sucessfully implemented SignalR in my android application. and message broadcasting is also working fine. i want to implement p2p chat in my application using SignalR. i checked clients library in Asp.Net, i also tried Google but not getting required output. i checked SignalR, SignalA and SignalJ. i think SignalJ is useful but unable to resolve some library issue like scala and akka can anyone please help me. how can i implement p2p chat using SignalR in my android application? Thank

How to send message in cross domain using signalr

浪子不回头ぞ 提交于 2019-12-13 07:43:16
问题 In my current project I want to build messaging system but on subdomains. Suppose there is buyer.xyz.com and seller.xyz.com, the buyer and seller can send message to each other and there is no user roles, buyer and seller are from diffrent tables. when buyer send message the message gets inserted in message table and specified seller should get updated if he is currently online and vice versa. I am new in signalr. If possible please give code examples. 回答1: Basically, the best way to get

Handling concurrent connections in SiganlR

孤街浪徒 提交于 2019-12-13 02:38:25
问题 I am using .Net framework 4.5.2 and I will start to make a notification system that send notifications from web application into users that are connected from windows forms desktop application . after investigations i found that the suitable solution is using signalR as it supports filtering the notification before sending it to the connected clients . but my concern here is that : when i created my HUB class in the web application , i implemented the method OnConnected that will detect any