signalr-hub

SignalR AuthorizeHubConnection

可紊 提交于 2019-12-12 15:41:49
问题 I want to authenticate users when they connect to the signalr server. The clients are javascript and are cross-domain. I tried using this example and the AuthorizeHubMethodInvocation gets called but the AuthorizeHubConnection never gets called. I created a new class AuthTicketAttribute where i override the two methods, public class AuthTicketAttribute : AuthorizeAttribute { public override bool AuthorizeHubConnection(HubDescriptor hubDescriptor, IRequest request) { return base

Get SignalR User (Hub.Context) outside of hub

本小妞迷上赌 提交于 2019-12-12 13:45:27
问题 is there any way to get current signalR request user outside the hub? I can use Hub.Context.User inside of hub methods, but if hub method calls any other underlying layer? Wcf service call - an additional BehaviorExtensionElement is used to add wcf message header with current user identity name. public object BeforeSendRequest(ref Message request, IClientChannel channel) { request.Headers.Add(MessageHeader.CreateHeader( Constants.HeaderNames.SessionId, Constants.HeaderNames.HeaderNamespace,

Client Function Not getting called SignalR

不打扰是莪最后的温柔 提交于 2019-12-12 10:56:44
问题 Controller class Where Hub is defined public abstract class MonitoringProfileLogChartController : Croem.NotificationManager.Website.Base.BaseController.BaseController { public ActionResult Index() { BusinessLogicReturn result = new ProcessBusinessLogic.Logic().GetRegisteredContexts(); return base.TransalateToAction(result); } public ActionResult LiveMonitoringProfileLogChart() { return View(); } public ActionResult test() { return View(); } **below is rest of the code of controller where our

Azure SignalR: HubException method does not exist

限于喜欢 提交于 2019-12-12 10:20:43
问题 I am finding we receive this error: Failed to invoke 'CreateChatRequest' due to an error on the server. HubException: Method does not exist. at _this.callbacks.<computed> (chat.min.js:2060) at HubConnection.processIncomingData (chat.min.js:2154) at WebSocketTransport.HubConnection.connection.onreceive (chat.min.js:1881) at WebSocket.webSocket.onmessage (chat.min.js:3922) The method does exist. The code does work, then after a while of testing, it returns this and won't stop. What seems to

signalR tracking connected users

岁酱吖の 提交于 2019-12-12 08:12:39
问题 I need to check whether a specific user is still connected. I have the following HashSet that keeps track of users: public static class UserHandler { public static HashSet<string> ConnectedIds = new HashSet<string>(); } So on disconnected: public override Task OnDisconnected() { UserHandler.ConnectedIds.Remove(this.Context.ConnectionId); if (UserHandler.ConnectedIds.Count == 0) { // STOP TASK -> SET CANCELLATION } return base.OnDisconnected(); } and on Connected: public override Task

SignalR - Send message OnConnected

橙三吉。 提交于 2019-12-12 07:49:52
问题 I've been experimenting with SignalR today and It's really neat. Basically what I wanted to achieve is the following: As soon as a device connects it should send a message to the first one. If there are more devices than 1 connected I would like to send two messages. One to all except the last connected client. And one message to only the last connected client. The code I've been using works perfect when I place it in a custom API controller and basically call the action, but that's not what

Sharing a SignalR hub between a WebApi and MVC project

♀尐吖头ヾ 提交于 2019-12-12 07:13:13
问题 Is there a recommended approach to sharing a SignalR hub across two applications? The actual situation is a public facing WebAPI project and an internal MVC WebApp. What I'd like to do is call methods on a SignalR hub from the WebAPI project and have the results of these methods pushed to clients connected via the MVC app. Would the best option be to create a third 'Hub' project and have both projects connect to that? If so, how are the hub instances managed? Can both applications get a

Signalr/hubs js high response time

倖福魔咒の 提交于 2019-12-12 02:16:08
问题 When i check network activity of my site in chrome developer tools i found that singalr/hubs script it taking long time to response. i have attached screenshot. is it normal or something wrong with implementation? 回答1: This is very normal for Server Sent Events. Client opens one connection on server and they use this connection for communucation. Check this article for detail. 来源: https://stackoverflow.com/questions/36872509/signalr-hubs-js-high-response-time

SignalR Hub's Groups dont work with long polling

杀马特。学长 韩版系。学妹 提交于 2019-12-11 13:32:59
问题 I have a Web App(.NET 4.0 ASP.NET MVC3) which uses SignalR(1.0.0 alpha 2) with Hubs and Persistent Connections. With the Hubs I use groups to send push notifications to some clients. The problem is that when the server is accessed remotely it defaults to long pooling and only the persistent connections work. With hubs the event happens on the server but my callback is not called at the client. It works locally, though it uses SSE. What I found is that the combination of Grouping the clients

SignalR not works on Google Chrome

人盡茶涼 提交于 2019-12-11 13:25:56
问题 I have updated the signal R version from 1.1.3 to 2.1.2 in my project, but after updating it i found that implemented all functionality working proper on Firefox & Internet Explorer but not on Google Chrome. I'm already used long-polling & related solution but then also its not working, Actually Google Chrome is able to sends the update Signal's but not able to receive any signals from another browser. 回答1: After updating Google Chrome with version 41.0.2266.2 canary, it's working properly.