signalr

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 not working on specific isp networks

假装没事ソ 提交于 2019-12-10 02:17:29
问题 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

第三章SignalR在线聊天例子

倾然丶 夕夏残阳落幕 提交于 2019-12-10 02:12:53
第三章SignalR在线聊天例子 本教程展示了如何使用SignalR2.0构建一个基于浏览器的聊天室程序。你将把SignalR库添加到一个空的Asp.Net Web应用程序中,创建用于发送消息到客户端的集线器(Hubs)类,创建一个Html页面让用户在该页面上发送和接收聊天信息。对于如何在MVC5环境中创建这个聊天室程序,请参阅 Getting Started with SignalR 2.0 and MVC 5 。 SignalR是一个开源的.Net库,用于构建需要实时用户交互或实时数据更新的Web应用程序。比如社交网站应用、多用户在线游戏、商务协作、新闻、天气、金融或更新应用的程序。以上通常被称为----实时应用程序。 SignalR简化构建实时应用程序的过程。它包含一个Asp.net服务器库和一个JavaScript客户端库,使其更容易管理客户端到服务器端的连接并推送内容到客户端让其更新。您可以将SignalR库添加到现有的Asp.net应用程序已实现实时功能。 本教程将演示SignalR是如何开发的: 1) 添加Signal库到Asp.net Web 应用程序。 2) 建立一个集线器(Hubs)类来推送更新内容到客户端。 3) 建立一个.Net开放Web 接口(OWIN)启动类来配置应用程序 4) 杂网页中使用SignalR jQuery库发送和显示更新消息

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

风格不统一 提交于 2019-12-10 00:36:00
问题 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? 回答1: Yep. You can use $.connection.hub.id . 回答2: 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

Is there a way to exclude a Client from a Clients.method call in SignalR?

随声附和 提交于 2019-12-09 19:06:48
问题 I am evaluating SignalR (which happens to be used with Knockoutjs) to see if we can use it to notify clients of concurrency issues. Basically user "a" saves a record and users "b,c,d,e,f,g" are notified. I basically have an example working that notifies all clients. So I think I am almost there. I came across this link and it lead me on the current path that I am on. I have also been looking at the documentation on Github. Basically I want to exclude the a single client from the Clients

SignalR and Joining Groups

前提是你 提交于 2019-12-09 17:33:07
问题 I am looking at SignalR for a project I am working on, and it seems to be EXACTLY what I want. However one bit that I am still a bit baffled by is the groups and joining. I will try to describe the context of the implementation first. So a user within an existing system will want to hold a meeting about a given topic and will then create a room with a given name/identifier, they will then invite others into it and then it will basically be like a private chat room. So the steps I assume would

SignalR Hub Overloads

若如初见. 提交于 2019-12-09 17:19:11
问题 I tried creating a basic hub with two Receive methods, one accepts a string and the other an int. This causes an error stating that the method cannot be resolved. Commenting out one of the methods gets rid of the error and everything works. Is it possible to have overloads of a method in my hub? Could something like overloads be done? 回答1: SignalR does support overloading server-side Hub methods, but the overloads must have a different arity, i.e. take a different number of arguments. If the

disconnect client from server side signalr

守給你的承諾、 提交于 2019-12-09 14:32:39
问题 I'm using SignalR 1 with MVC4 C# web application with form authentication. I have a code in my layout page in JavaScript : $(documnet).ready(function(){ connect to hub code ... }) I want to disconnect a user form the hub and start connect again after he does a login and validate ok. I want to do it from server side inside my account controller and method : public ActionResult LogOn(LoginModel model, string returnUrl) { if (ModelState.IsValid) { if (System.Web.Security.Membership.ValidateUser

[.NET]SignalR簡介

偶尔善良 提交于 2019-12-09 13:28:54
前言 一早起床後,在消化 RSS 的過程中,看到 Scott Hanselman 在 Russia TechDays 介紹 SignalR 的影片,一整個讓人很驚豔,馬上就想動手寫寫看。 由於我也是初學者,先把相關 Reference 列上來,有興趣的朋友可以直接參考官網或影片,應該會比我的文章清楚的多。 Reference : github: SignalR Russia TechDays 影片 Scott Hanselman blog 簡介 SignalR 的重點,就在於即時 (realtime) ,以往在設計網站的時候,基本上都是透過 client 頁面重新整理頁面、重送 request 或定時輪詢 server 端,以重新呈現即時的資料。但那根本不是即時,即時應該是 server 端一旦有了最新的資料,會主動通知 client 端更新資料的呈現。 但這樣的機制,往往得透過很多機制,很多複雜的設計,才有可能達成。 SignalR 則像撰寫 .NET Remoting 一般 在 server 端定義對應的 hub class。 在 client 定義 hub class 所對應的 proxy。 在 client 與 server間,建立一個不斷的connection。 接著 client 端可以呼叫 proxy object 的方法,也就是 server 端的方法,也就是送

ASP.NET Core 3.0 入门

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