signalr

How to create Hub Proxy using AspNetCore SignalR

為{幸葍}努か 提交于 2020-01-21 11:56:07
问题 Anyone know the AspNetCore SignalR equivalent of this code from AspNet SignalR? Task.Factory.StartNew(() => { //// var clients = Hub.Clients<RealTimeNotificationHub>(); var connection = new HubConnectionContext("https://demohouse.go.ro:96/"); var notificationmessag = new AlertMessage(); notificationmessag.Content = "New message from " + device.Name + " <b>" + text + " </b>"; notificationmessag.Title = alertType.Name; var myHub = connection.CreateHubProxy("realTimeNotificationHub"); connection

Access DB context through SignalR Core

女生的网名这么多〃 提交于 2020-01-21 09:19:25
问题 I'm using AspNetCore.SignalR and I need advice on how to access my SQL Server database through my Hub. There are not a lot of resources out there about this. I know how to add a singleton but I do not know how to access it later. How can I access a DB context that is defined using a Configuration.GetConnectionString in Startup.cs inside my Hub's Tasks? Thanks. Here's the relevant code: Startup.cs public void ConfigureServices(IServiceCollection services) { services.Configure

Does signalR backplane shares connections also?

元气小坏坏 提交于 2020-01-17 05:16:22
问题 Does signalR backplane shares the connection information also? I mean in case of "longpolling" the connect request goes to one server and start server goes to another server then it gives this error "The ConnectionId is in the incorrect format." I am believing that this error is coming because the instance on which this request is going does not have any information about this connection id. I am using SQL server backplane but still facing this problem. We are not supposed to use sticky

Cannot load signalr hubs file correctly after IIS rewrite

。_饼干妹妹 提交于 2020-01-17 03:07:45
问题 I'm working on an application using ASP.NET Web API, SignalR and AngularJS. Ui-router is being used and html5 Mode is enabled . I've edited the web.config file and the rewrite rule is like this: <rule name="AngularJS Routes" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <add input="{REQUEST_URI}" matchType="Pattern"

Cannot load signalr hubs file correctly after IIS rewrite

喜你入骨 提交于 2020-01-17 03:06:04
问题 I'm working on an application using ASP.NET Web API, SignalR and AngularJS. Ui-router is being used and html5 Mode is enabled . I've edited the web.config file and the rewrite rule is like this: <rule name="AngularJS Routes" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <add input="{REQUEST_URI}" matchType="Pattern"

asp.net core with signalR < - > static socket

瘦欲@ 提交于 2020-01-16 11:59:09
问题 Use Case: I have a asp.net core web application with signalR core for messaging. :) Problem: I have to receive messages from a socket connection [via System.Net.Sockets] (machine with own socket communication) Is there any way to integrate the socket client in the web app (maybe Progamm.cs or Startup.cs?) And how can I get access to the signalR to forward the received message to the signalR Hub? thx 回答1: I suggest you to read the stockticker sample on : https://docs.microsoft.com/en-us/aspnet

SignalR IE9 Cross Domain request don't work

情到浓时终转凉″ 提交于 2020-01-16 05:33:08
问题 I'm making an application using SignalR. The Hub is placed on one server running Windows Server 2012 with IIS 8. http://mentor.cloudapp.net/mass/rexona/previa/signalr/hubs. The client is here: http://massdeveloperstage.com/Rexona/Site/colombia/Previa/Match?matchId=6F318A29-3400-444B-95D9-7EC41A7AD2D4 The Signalr set up looks like this: var match; $(document).ready(function () { $.connection.hub.loging = true; match = $.connection.match; match.client.addMessage = function (message) { var vm =

SignalR hubclass in classlibrary

血红的双手。 提交于 2020-01-16 01:55:08
问题 I have a signalr hubclass in a classlibrary and when i use that hubclass in my webapplication referencing that class library with below javascript code, it does not work, $(function () { var chat = $.connection.notificationHub; chat.client.newMessage = function (message) { alert(message); $('#messages').append('<li><strong>' + message + '</strong>: </li>'); }; $.connection.hub.start(); }); 回答1: You need an event to trigger your method in Hub class. See below example: NotificationHub in the

show the list of usernames inside a div

*爱你&永不变心* 提交于 2020-01-14 19:07:41
问题 I am new to jQuery. In my project, I created one Class User in which the code is as shown below: static ConcurrentDictionary<string, User> _users = new ConcurrentDictionary<string, User>(); // // some function to add values to _users list // public List<User> GetConnectedUsers() { return _users.Values.ToList(); } I want to show this list of values in div #showUsernames. How to do this by using jQuery? I tried the below which is not showing anything /*display your contacts*/ $('#showUsernames'

show the list of usernames inside a div

那年仲夏 提交于 2020-01-14 19:05:58
问题 I am new to jQuery. In my project, I created one Class User in which the code is as shown below: static ConcurrentDictionary<string, User> _users = new ConcurrentDictionary<string, User>(); // // some function to add values to _users list // public List<User> GetConnectedUsers() { return _users.Values.ToList(); } I want to show this list of values in div #showUsernames. How to do this by using jQuery? I tried the below which is not showing anything /*display your contacts*/ $('#showUsernames'