signalr

Use of /signalr/ping call when using long polling

时间秒杀一切 提交于 2019-12-05 01:23:35
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 /ping call configurable? The entire purpose of the /signalr/ping request is to keep ASP.NET sessions

signalr not working on specific isp networks

試著忘記壹切 提交于 2019-12-05 01:09:52
I'm using ASP.NET MVC 4 and SignalR 2.1.1. My website works great for most users in all browsers, but there is an error that only occurs for certain user on specific isp-networks. The error is this: The connection to ws://domain.com/signalr/connect?transport=webSockets&clientProtocol=1.4&connectionToken=78ZpJ007jmlLSBbVzDVbfpYahHsveD3x8%2Bc5PC9h%2FgeOz5zNgE8SaKWaQAasGNLe%2BvJeI6ux6IqW0E8WQWqP6Ps%2FXjc8WPbG7G47oHSxRSx7nVj0leVa1DdXzEXnLQ%2BA&connectionData=%5B%7B%22name%22%3A%22homehub%22%7D%5D&tid=4 was interrupted while the page was loading. For the same users receiving this error, logging in

SignalR authentication failed when passing “Bearer” through query string

China☆狼群 提交于 2019-12-05 00:08:33
问题 I'd like to enable authentication in SignalR while the server was hosted in ASP.NET WebAPI which I'm using OAuth Bearer authrntication and the client is AngularJS. On client side I originally pass the Bearer token through HTTP header and it works well with the WebAPI. But since SignalR JavsScript doesn't support adding HTTP headers in connection (it's because WebSocket doesn't support specifying HTTP headers) I need to pass the Bearer token through query string by using the code like self

Storing chat conversations in sql database using signalR

浪子不回头ぞ 提交于 2019-12-04 22:27:14
问题 I'm developing a class library that contains generic methods for these scenarios: Live support chat (1 on 1 private text chat, with many admins and guests) Rooms with many users where you can send broadcast and private messages These two features above are already implemented and now it's necessary for my application to save messages. My question is, what is the best way to store chat conversations in a SQL database: Everytime I click send, I insert the message in the database? Create a List

signalR : /signalr/hubs is not generated

若如初见. 提交于 2019-12-04 22:25:17
I can get this tutorial to work in a new project, but not in my existing project. My project is an ASP.Net MVC 4 web application with the following attribute in the web.config file: <appSettings> <add key="webpages:Enabled" value="true"/> </appSettings> This is because my application is a Single-Page-Application, which uses AngularJS on the client side. The only page in my application is index.cshtml, to which I've added the relevant code for signalR: <!-- signalR chat --> <script src="~/Scripts/jquery.signalR-1.0.0.js"></script> <!--Reference the autogenerated SignalR hub script. --> <script

how to get SignalR user connection id out side the hub class?

只愿长相守 提交于 2019-12-04 22:15:44
I am using SignalR in my ASP.NET web application. Here I am calling client from outside to hub class using IHubContext . I need to get the current user's connection ID in order to send messages to the current user only. How can I get the connection ID on the client side? Ruchira Yep. You can use $.connection.hub.id . There's another way also, you can get connection id into your controller from hub by invoking a method of hub and you can return the required ID from there. Controller Code var HubContext = GlobalHost.ConnectionManager.GetHubContext<"ChatHub">(); //`ChatHub` can be your Hub Name

ASP.NET Core 3.0 入门

六月ゝ 毕业季﹏ 提交于 2019-12-04 20:25:05
课程简介 与2.x相比发生的一些变化,项目结构、Blazor、SignalR、gRPC等 视频预计结构 ASP.NET Core 3.0项目架构简介 ASP.NET Core MVC 简介 Blazor SignalR Web API gRPC 发布 一. 创建项目 dotnet core 本质上是控制台应用 DI 依赖注入(Dependency Injection) IoC 容器(Inversion of Control)控制反转 注册(服务) 请求实例 实例的生命周期 生命周期 Transient(每次被请求都会生成一个新的实例,最短) Scoped(一次 Web 请求产生一次实例,较长) Singleton(从应用程序启动到停止,只创建一次,最长) 1. ConfigureServices services.AddControllersWithViews(); services.AddControllers(); // 别的类每次请求 IClock 这个接口时,都会返回一个 ChinaClock 类的实例 // services.AddSingleton<IClock, ChinaClock>(); services.AddSingleton<IClock, UtcClock>(); 当需要更改接口的实现类的时候,只需要在依赖注入中修改即可。 public class

SignalR Join Group From Controller

你离开我真会死。 提交于 2019-12-04 20:08:44
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 possible, or am I approaching this problem incorrectly? Thankyou for any advice. You shouldn't new up a

How to hook up SignalR with an Angular 7 application

余生颓废 提交于 2019-12-04 20:07:56
问题 I simply cannot figure out how to make a signalr connection from Angular. Using the following tutorial at https://docs.microsoft.com/en-us/aspnet/signalr/overview/getting-started/tutorial-getting-started-with-signalr-and-mvc I've added a new SignalR 2.4.0 project to an existing .Net 4.6 solution in vs2017. I also have an Angular 7 application to which I've added the SignalR package via npm install @aspnet/signalr Now I'm trying to hook up a simple connection between client and server, but can

How to publish messages using the SignalR SqlMessageBus

天涯浪子 提交于 2019-12-04 19:25:43
I have a Windows Service that I'd like to periodically publish some data. I know I can use the .NET HubConnection object to create a proxy to a SignalR hub and send a message through it but since the web app is hosted on an IIS web farm that can get a bit hacky. The web farm hubs are connected using the SQL Server-based SqlScaleoutConfiguration backplane. What I'd really like to do some thing like this: var config = new SqlScaleoutConfiguration(sqlConnString); GlobalHost.DependencyResolver.UseSqlServer(sqlConnString); //Redundent?? var messageBus = new SqlMessageBus(GlobalHost