signalr.client

Detect SignalR Hub Client Disconnect instantly

两盒软妹~` 提交于 2019-12-10 14:42:58
问题 When is the SignalR Hub OnDisconnected raised on server side, for the the .net client that crash or close without calling the Stop method? I am testing with the SignalR .NET client, not the javascript client. If I call the Stop method on the client, the Hub will raise OnDisconnected method immediately. But if I close the client or kill the process, the Hub will raise OnDisconnected method only after about 10 seconds. How can I detect instantly that the client is disconnected? 回答1: Having read

Implementing Authorization in a Self Hosted SignalR Server accessed from Web

女生的网名这么多〃 提交于 2019-12-10 13:58:57
问题 I'm looking for some guidance on how to implement authorization security for SignalR on a back end service running in a self-hosted (non-IIS) environment, that is called from a Web application. The backend app is basically a monitor that fires SignalR events back to the HTML based client. This all works fine (amazingly well actually). However, we need to restrict access to the server for authenticated users from the Web site. So basically if a user is authenticated on the Web site, we need to

How to use async/await with hub.On in SignalR client

泪湿孤枕 提交于 2019-12-10 03:54:01
问题 I have a .Net Windows Service (client) that's communicating with a SignalR Hub (server). Most of the client methods will take time to complete. When receiving a call from the server, how do I (or do I need to) wrap the target method/hub.On to avoid the warning: "Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the await operator to the result of the call" On the client, this is a sample of the start up / setup code:

Use of /signalr/ping call when using long polling

*爱你&永不变心* 提交于 2019-12-10 02:41:57
问题 I'm using long polling with SignalR. I've found that user session ends (ASP.NET Session_End is being called) right after singalr based webpage makes /signar/ping request (as shown in this screenshot). I went through http://www.asp.net/signalr/overview/signalr-20/hubs-api/handling-connection-lifetime-events but couldn't figure out clear answers following questions. How to keep ASP.net user session alive from a signalr client webpage? What is the actual purpose of /ping? Is the timing for this

HttpClientException when connecting to working hub from SignalR .NET Client

你。 提交于 2019-12-10 02:25:30
问题 I have a working SignalR application that allows me to connect multiple JavaScript clients and exchange data. When I tried to connect with a .NET client I get the following error: An exception of type 'Microsoft.AspNet.SignalR.Client.HttpClientException' occurred in mscorlib.dll but was not handled in user code Additional information: StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.StreamContent, Headers: { Transfer-Encoding: chunked X

SignalR Websocket Exception when closing client

跟風遠走 提交于 2019-12-09 15:37:44
问题 When starting and stopping a SignalR client that is connected to a basic self hosted server like this: async public void Start(string url) { _connection = new HubConnection(url); _proxy = _connection.CreateHubProxy("hubname"); await _connection.Start().ContinueWith((task) => IsRunning = true); } public void Stop() { _connection.Stop(); } I get the following exception when calling the "Stop" method (including trace messages): SignalR.Transports.TransportHeartBeat Verbose: 0 : KeepAlive

Using SignalR server from Python code

倖福魔咒の 提交于 2019-12-08 15:05:30
问题 What are my options for integrating Python with SignalR? The Python code is a part of large 3rd party product, not a matter of language preference. SignalR server provides subscriptions to existing .NET products. We would like to reuse .NET SignalR server with Python. 回答1: I can think of a few ways and they are all theoretical (and probably bad ideas to begin with): IPC - host the python app and the signalr app as different processes and somehow pipe information back and forth using some kind

Signalr Owin simple example javascript client not being called

断了今生、忘了曾经 提交于 2019-12-08 12:42:07
问题 I have a 5.3.0 version of signalr self hosting that is being upgraded to a newer version of signalr. Using https://github.com/SignalR/SignalR/wiki/Self-host example i have created a simple example, but i can’t get it to work. I can get a connection to the hub on the server and call methods on the hub, but i can’t get the hub to call the javascript client. When looking at it in fiddler I never see a response come back from the hub. Here is the code using System; using Microsoft.AspNet.SignalR;

Connect to SignalR server in dotnet core from .NET client

一曲冷凌霜 提交于 2019-12-08 08:39:05
问题 I have a signalR server implemented in Dotnet Core 2.0, below is the code for the server Startup.cs public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddSignalR (); } public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseMvc(); app.UseSignalR (routes => { routes.MapHub <NotificationsHub> ("notificationshub"); }); } NotificationsHub.cs public class NotificationsHub :

SignalR, Server side methods can be called, but client side methods cannot, only in production environment

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 07:48:29
I have successfully developed an hub for my newsletter sending function in a .net website. The server procedure is called by the hub, then during the sending routine, I send a client methods to report the progress status, and finally another client method to report ending of the routine. My dev environment is win10 with IIS 10, VS2013, .NET 4.5 SignalR 2.2.0. I can use websocket in my dev and work fine, but my production server is win 2008r2 (IIS 7.5), so I must use serverSentEvents, working as well on dev. Here my client code: $.connection.hub.logging = true; hubConn = $.connection