signalr

SignalR Autofac Inject Authorize Attribute

一曲冷凌霜 提交于 2019-12-24 00:27:51
问题 I'm trying to figure out a way to inject dependencies into my AuthorizeAttribute in SignalR similar to the way it is done in WebAPI. In Web API I know I can call builder.RegisterWebApiFilterProvider(config); but I can't quite seem to find an equivalent for SignalR. The closest thing I can find that looks like it might do the trick is the PropertiesAutowired() method. I have tried builder.RegisterType<MyAuthorizationAttribute>.PropertiesAutowired(); where my attribute looks like public class

Managing SignalR connections for Anonymous user

馋奶兔 提交于 2019-12-23 20:22:26
问题 I am using SignalR version 2.1.2 with ASP.Net MVC 5 & NServiceBus and have following requirement There is a signup page (anonymous authentication) in which SignalR is used to send notifications. Every form submit will generate a new connection id which needs to be kept in a collection so that I can send response to the client. Context.User.Identity.Name is empty hence _connections.Add(name, Context.ConnectionId); cannot be used in OnConnected() hub event as given in this post Similar problem

SignalR web client without ASP.NET?

梦想的初衷 提交于 2019-12-23 19:47:41
问题 Is it possible to write a WebSocket (SignalR) client without having to embed it in an ASP.NET application hosted on IIS (or other ASP.NET web server)? For example if I have a Self Hosted SignalR Server with a custom Hub, is it possible (and if so, how) to call it from a "pure" Javascript web client? In that case we don't have the <script src="~/signalr/hubs" type="text/javascript" /> part with the run-time generated "magic" scripts in the ~/signalr/hubs/ folder. 回答1: You do not need to have

Can a client connect directly to SignalR using only websockets?

心已入冬 提交于 2019-12-23 19:23:43
问题 I want to build a real-time data API using SignalR on the server. I will be building a web client that will connect with the API the "usual way". However, I would like 3rd parties to also be able to connect to this API. These clients may be web clients or other platforms such as Windows, Mac, iOS, etc. Ideally, they'd just be able to connect via plain websockets and be totally agnostic of whether SignalR is in use on the server or not. It seems that there are a lot of libraries out there for

How can I authenticate a websocket connection where client and server reside on seperate domains?

淺唱寂寞╮ 提交于 2019-12-23 15:02:17
问题 I'm currently playing around with SignalR and websockets. From my research, it seems, as websockets do not support custom headers, there's basically only two ways to authenticate a websocket connection during token based authentication. 1) Passing the token in the query string 2) Storing the token in a cookie which then gets passed to the server when WithCredentials is set to true The first method isn't great practice - even through websocket communication is encrypted, query strings may be

C# SignalR Exception - Connection started reconnecting before invocation result was received

痴心易碎 提交于 2019-12-23 13:40:59
问题 I am developing 2 applications, the first being a C# console application and the other an Asp.net web application. I am using SignalR to connect the two. This is my C# console application (Client) public class RoboHub { public static IHubProxy _hub; public RoboHub() { StartHubConnection(); _hub.On("GetGoals", () => GetGoals()); _hub.On("PrintMessageRobot", x => PrintMessageRobot(x)); Thread thread = new Thread(MonitorHubStatus); thread.Start(); } public void GetGoals() { //TODO: Does stuff }

Why does an idle SignalR connection have 4-6 Mbps network load locally? [closed]

北城余情 提交于 2019-12-23 13:01:11
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . My SignalR enabled app creates a high local network traffic, but only if running in Chrome and if the app hosted locally by IIS Express. The SignalR connection itself is idle. Nothing is transmitted through the connection. If I start the app in FF/IE more or less no network activity is visible. As soon I start

Using generic methods on SignalR Hub

孤街浪徒 提交于 2019-12-23 12:54:28
问题 I'm creating a Hub class for my SignalR server and wanted to use a generic method which will save me from tons of lines of code. But SignalR is giving me errors when I try to Invoke the server code below from a Xamarin.iOS client which also in C#. Server Code public List<T> SendDataToClient<T>() where T : BusinessEntityBase { return SomeDBManager.GetItems<T>(); } Client Code var list = await hubProxy.Invoke<List<Article>>("SendDataToClient"); Am I doing something wrong here or is it just

Detect lost connection from SignalR Core connection

北战南征 提交于 2019-12-23 12:43:37
问题 I'm trying to detect when a SignalR Core connection is lost so that I can create a new one or at least warn the user. connection.on('closed', data => { alert('Connection Closed'); }); This seems to have no effect. The messages stop arriving but this handler isn't fired. On a related note, where is the documentation for event handling for the new version of this library? 回答1: Use onclose : connection.onclose(function (e) { alert('Connection Closed'); } There's no documentation yet, but a

How reliable is SignalR Backplane?

自闭症网瘾萝莉.ら 提交于 2019-12-23 12:35:17
问题 How reliable is SignalR Backplane regarding to the question if all messages will reach all subscribed nodes? Is it using a reliable protocol underneath or are there chances that a message can get lost? Obviously it can be that (for example) due to some network issues one node is down for some time. When it becomes reachable again, SignalR Backplane will deliver all intermediate messages. This is at least what I understand from davidfowl: [...] This is VERY important! SignalR is NOT reliable