signalr-hub

Context is null in SignalR hub

巧了我就是萌 提交于 2019-12-07 07:27:15
问题 I have a Web Forms application and testing to see how SignalR works for one of my requirement. My hub code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using Microsoft.AspNet.SignalR; namespace SignalRTest.Hubs { public class NotificationHub : Hub { public static readonly System.Timers.Timer _Timer = new System.Timers.Timer(); public NotificationHub() { var myInfo = Context.QueryString["myInfo"]; _Timer.Interval = 2000; _Timer.Elapsed += TimerElapsed;

calling the Caller method in SignalR hub outside the hub context

故事扮演 提交于 2019-12-07 05:36:15
问题 I have a question in my mind about the Caller method of SignalR. In the hub method we can call a client side function like this. Clients.Caller.addContosoChatMessageToPage(name, message); but when i use to call it from outside the hub context it is not found or not implemented?? like this.. var context = GlobalHost.ConnectionManager.GetHubContext<MyHub>(); context.Clients.Caller.reportProgress(recordCount,totalCount); Can someone enlighten me in this part or is there other way to implement it

SignalR 2.0 in VS2012 registration and Dependency Injection

北慕城南 提交于 2019-12-06 15:59:11
I was able to work with SignalR 1.13 with my own DI like this: //Funq container GlobalHost.DependencyResolver = new FunqDependencyResolver(container); RouteTable.Routes.MapHubs(); Now with the new version 2.0 I am stuck. using Microsoft.Owin; using Owin; //SignalR 2.0 no longer uses RouteTable.Routes.MapHubs(); [assembly: OwinStartup(typeof(SignalRChat.Startup))] namespace SignalRChat { public class Startup { public void Configuration(IAppBuilder app) { app.MapSignalR(); } } } (New SignalR 2.0 setup in VS2013 screenshot) Firstly, it's a screen from VS2013 from here . my VS2012 Pro doesn't have

SignalR 2.2.0 WebSocket error connecting to hub

心已入冬 提交于 2019-12-06 14:18:45
I have an ASP.Net MVC application that I have added SignalR to. After following the " Getting Started " tutorial (with modifications of course since it's going in my application) I got it working on localhost. However once it's in the production environment, I get the following error: WebSocket connection to 'ws://xxxxx/signalr/connect?transport=webSockets&clientProtocol=1.5&connectionToken=xxxxx' failed: Connection closed before receiving a handshake response. I can access /signalr/hubs (I get a js file). Any ideas as to why this would happen? André Pena This may be due to the fact that your

SignalR IAssemblyLocator override not firing

帅比萌擦擦* 提交于 2019-12-06 13:47:27
I have a simple app which uses several hubs, some in the same project and one in another class library, and everything is working fine. Now I want to try and load a hub that's been created at run-time using CSharpCodeProvider.CompileAssemblyFromSource, and have my client communicate with that hub. It's not showing up in /signalr/hubs/. As one of several things I'm trying to get working, I'm trying to use a custom IAssemblyLocator as described here: https://github.com/SignalR/SignalR/wiki/Extensibility But my GetAssemblies() code isn't being called as far as I can tell. This is my Global.asax

SignalR Join Group From Controller

∥☆過路亽.° 提交于 2019-12-06 13:00:41
问题 When the user logs in on my site, they select from a dropdown which group they belong to. On the login postback, as they are logged in, I'd like to assign them to the correct SignalR group. As per the documentation here, I can join it client-side via: contosoChatHubProxy.server.joinGroup(groupName); Is there a way to assign the group from the controller? I can call the Hub like: var hub = new NotificationHub() hub.JoinGroup(selectedGroup); but the Context in the hub method is null. Is this

SignalR Groups not getting data

坚强是说给别人听的谎言 提交于 2019-12-06 09:01:00
Hi I am having a problem where my signalR clients who are in a group do not get the information sent. I have tried this in two ways and both not working. On web page loaded the client will call the server to get the group name and then call a method on the hub to join the user in that group. JavaScript..... var connectionOpen = false; var myHub; $(function () { myHub = $.connection.myHub; myHub.client.showMessage = alertMessage; $.connection.hub.start(function () { connectionOpen = true; joinGroup(); }); }); function joinGroup() { $.ajax({ url: 'Controller/GetGroupName, type: 'POST', success:

SignalR on Xamarin.iOS - randomly not able to call Hub method

自闭症网瘾萝莉.ら 提交于 2019-12-06 08:11:11
问题 I have a simple Hub running in Azure, that I have working perfectly from a console app in Windows. I just built a simple test Xamarin.iOS app, and it is giving some strange behavior. Randomly on LTE/Wifi or Simulator/Device - invoking a hub method fails with There was an error invoking Hub method X Randomly about 50% - everything works perfectly just like the console app on Windows - the two are even sending messages to one another I tested this on an iPhone 5S and iPhone 4S for devices. Any

SignalR: How to stop creating new connection on page reload

耗尽温柔 提交于 2019-12-06 07:41:23
问题 Hi i am developing a chat application along with some other pages in my application. once i login i am maintaining the session of the user. My main intention is that user should get notification whenever another user connects to server. The problem that i am facing is whenever i navigate to some other page in my application the connection is lost. How to stop this behaviour and continue the connection until user logs out. I am using SignalR 2.0 in ASP.NET MVC4 project, any help?? 回答1: Each

SignalR Broadcast Intercept Using Pipeline Module

依然范特西╮ 提交于 2019-12-06 06:05:00
I have created a setup where I have a back-end service that is broadcasting messages using SignalR through a SQL backplane and clients are receiving the messages through a MVC 5 + SignalR web application on a web farm. I want to intercept the messages before they get to the client from the web application and make some changes to the message, specifically return HTML to the client instead of the raw data. I have been able to achieve this in a development environment where the messages originate from the web application (not farmed) adding a HubPipelineModule class with an OnBeforeOutgoing