signalr

Best Practices for reconnecting a disconnected SignalR client (JS)

只愿长相守 提交于 2019-12-04 09:55:48
I'd like to improve the resilience of my clientside implementation of a signalR client. Currently, I do this: hub.server.sendClientNotification(string, appSettings.username()); However occasionally, an exception related to connectivity is thrown because either the server is not responding or the client's internet connection has become unusable. I'd like to solve this by queuing up requests and then doing something like this: try { // pop from queue hub.server.sendClientNotification(string, appSettings.username()); // success - discard element } catch (e) { // requeue element } With this kind

Angular : Unable to pass API url in SignalR HubConnection

只谈情不闲聊 提交于 2019-12-04 09:34:16
I have developed a project in Angular6. There is a requirement to develop section for live chat. For that I am using SignalR in my asp.net core Web Apiproject. Now I want to use this Web Api reference in my Angular project. I am using this link. But while providing the Web Api url in App.Component.ts, I am getting below error : Constructor of class 'HubConnection' is private and only accessible within the class declaration. App Component.ts : import { HubConnection } from '@aspnet/signalr'; import { Message } from 'primeng/api'; export class AppComponent implements OnInit { public

MapHubs not needed in SignalR 1.01?

家住魔仙堡 提交于 2019-12-04 09:16:52
I am following the Hubs Quick Start Guide in the Signalr Wiki. I get an error in Global.asax, Application_Start on the line RouteTable.Routes.MapHubs(). A route named 'signalr.hubs' is already in the route collection. Route names must be unique. Parameter name: name Maybe this is not needed anymore in 1.0.1? It worked fine in 1.0. It is also mentioned in the readme.txt from NuGet that we need the MapHubs command. System.ArgumentException was unhandled by user code Message=A route named 'signalr.hubs' is already in the route collection. Route names must be unique. Parameter name: name Source

signalR generating different ID for various instances

烂漫一生 提交于 2019-12-04 09:09:32
I have created web chat application using signalR. When user is logged in, user can open only 3-4 tabs and each time different connection ID is generated. I want that when we open new tab or refresh the page new connection id should not be generated. I want to use the existing connection id. For that I tried to implement the LocalStorage variable to store the hub connection. But Problem is i am unable to parse the value of localstorage variable. Can Anyone give me the solution to my problem or can anyone give me any other solution to the problem? I have already tried this http://kevgriffin.com

signalR maintaining user connection ids

孤人 提交于 2019-12-04 09:01:21
问题 I am trying to maintain a connection id for the user ,i mean even he refreshes the page he gets the same connectionid This is what i could do till now the javascript part // Start the connection $.connection.hub.start(function () { chat.join(projectId, userId, userName); }).done(function () { alert("Connected!"); var myClientId = $.connection.hub.id; setCookie("srConnectionid", myClientId, 1); }); function setCookie(cName, value, exdays) { try{ var exdate = new Date(); exdate.setDate(exdate

Simple example of signalR not working

冷暖自知 提交于 2019-12-04 08:34:27
Not able to get SignalR working in my machine (with IE9). On entering some text and clicking submit, the text is not getting listed as intended. Also, I would expect the list getting updated from multiple instances of browser and It does not happen. There is no error. Could anybody help here? C# namespace TestSignalR.Hubs { using System; using System.Collections.Generic; using System.Linq; using System.Web; /// <summary> /// Summary description for ChatHub. /// </summary> public class ChatHub : SignalR.Hubs.Hub { public void TestMessage(string message) { Clients.writeMessage(message); } } }

Visual Studio 2013 Browser Link - Enable CTRL to Edit in Browser

笑着哭i 提交于 2019-12-04 08:02:19
How do you enable CTRL key for the Visual Studio Browser Link integration? Scott Hanselman discusses it here around 1:06:00 during the VS 2013 Launch Event . I'm not sure how to activate or enable the realtime HTML Edit feature so I can edit in the browser and have the changes pushed back to Visual Studio. Has anyone tried this out yet or can provide clues? I have VS 2013 RTM - I can't seem to find any update for ASP.NET Web Tools that may have changed this behavior. Is this an IE only behavior or is it browser independent? It sounds like it just injects additional HTML into the page.

Using SignalR with Redis messagebus failover using BookSleeve's ConnectionUtils.Connect()

孤者浪人 提交于 2019-12-04 07:48:38
问题 I am trying to create a Redis message bus failover scenario with a SignalR app. At first, we tried a simple hardware load-balancer failover, that simply monitored two Redis servers. The SignalR application pointed to the singular HLB endpoint. I then failed one server, but was unable to successfully get any messages through on the second Redis server without recycling the SignalR app pool. Presumably this is because it needs to issue the setup commands to the new Redis message bus. As of

Using SignalR Core to send messages from a Controller Method to Angular

爱⌒轻易说出口 提交于 2019-12-04 06:55:17
I'm trying to use SignalR for Asp Net Core 2.1 in order to send a message from a controller method which call is triggered from a test button in Angular. The behavior I'd expect is that when I click the button, my service invokes the controller method, which sends the test message. Then, I will simply log the message. I want to manage this in a service in order to avoid code duplication in all of the components. I've read some examples like this question about using SignalR in a service (I've used the second solution) and this article and the official docs but even with applying these concepts

SignalR: /signalr/abort throws error

笑着哭i 提交于 2019-12-04 06:55:09
Refused to execute script from '.../signalr/abort?transport=webSockets&clientProtocol=1.5&callback=jQuery32109752453231046265_1507885522267&_=1507885522271' because its MIME type ('') is not executable, and strict MIME type checking is enabled. A part of url was removed for clarity. I have the last stable version of Microsoft.Owin.Host.SystemWeb (3.1.0) and jquery.signalR-2.2.2.js . I'm using CORS. /signalr/start is working just fine. Any ideas? 来源: https://stackoverflow.com/questions/46726457/signalr-signalr-abort-throws-error