signalr.client

SignalR - Send message OnConnected

断了今生、忘了曾经 提交于 2019-12-04 03:34:16
I've been experimenting with SignalR today and It's really neat. Basically what I wanted to achieve is the following: As soon as a device connects it should send a message to the first one. If there are more devices than 1 connected I would like to send two messages. One to all except the last connected client. And one message to only the last connected client. The code I've been using works perfect when I place it in a custom API controller and basically call the action, but that's not what I want. I would like to send the messages as soon as a device connects within OnConnected without any

SignalR Websocket Exception when closing client

拈花ヽ惹草 提交于 2019-12-04 03:05:10
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(c75fe282-a86d-406a-935b-5981b47bd472) SignalR.Transports.TransportHeartBeat Information: 0 : Connection

SignalR client doesn't work inside AngularJs controller

≡放荡痞女 提交于 2019-12-03 15:45:15
I've created Angular application based on routes. Without using the routes, the Signalr works fine, but when I work with routes, the Signalr works just in one way - from client side to server. <html ng-app="SignalR"> <head> //Scripts <script src="~/signalr/hubs"></script> </head> <body> <a href="#/Today">Today</a> <a href="#/History">History</a> <div ng-view> </div> <script type="text/javascript"> var hubConnetion = undefined; hubConnetion = $.connection.hubs; $.connection.hub.start(); var SignalRControllers = angular.module('SignalRControllers', []); var SignalRApp = angular.module('SignalR',

SignalR authentication failed when passing “Bearer” through query string

六眼飞鱼酱① 提交于 2019-12-03 15:21:20
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.connection.qs = { Bearer: 'xxxxxx' }; The problem is on the WebAPI side my SignalR always returned 401

SignalR Client How to Set user when start connection?

孤者浪人 提交于 2019-12-03 07:17:01
Server side: public override Task OnConnected() { var connectionId = Context.ConnectionId; var user = Context.User.Identity.Name; // Context.User is NULL return base.OnConnected(); } Client side (in Console project): IHubProxy _hub; string url = @"http://localhost:8080/"; var connection = new HubConnection(url); _hub = connection.CreateHubProxy("TestHub"); connection.Start().Wait(); When the client connect to the server, I want to know the map between userName and connectionId, But Context.User is NULL. How do I set this value in the client side? Pass your username using query string. Client

signalr unity3d connection

房东的猫 提交于 2019-12-03 03:44:56
I am fairly new to signalr. Im using signalr core to make connection between unity and signalr but my code doesn't return me anything at all. That leaving me wondering if my code is actually working or not. After I've established connection, unity will wait for server side to call a function then it will execute what it need to do. here is my code : using System.Collections; using System.Collections.Generic; using UnityEngine; using Microsoft.AspNetCore.SignalR.Client; public class tyrNewSignalR : MonoBehaviour { void Start() { var connection = new HubConnectionBuilder() .WithUrl("http://api

SignalR authentication with webAPI Bearer Token

橙三吉。 提交于 2019-12-03 02:47:54
问题 +i used this solution to implement Token Based Authentication using ASP.NET Web API 2, Owin, and Identity...which worked out excellently well. i used this other solution and this to implement signalR hubs authorization and authentication by passing the bearer token through a connection string, but seems like either the bearer token is not going, or something else is wrong somewhere, which is why am here seeking HELP...these are my codes... QueryStringBearerAuthorizeAttribute: this is the

signalR MVC site loads indefinitely after signalR install [closed]

ε祈祈猫儿з 提交于 2019-12-02 13:40:19
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 7 years ago . I created a brand new MVC4 app. Installed new signalR package from NuGet: Install-Package Microsoft.AspNet.SignalR –pre Whenever I run it, it loads

Setting up Signal R in Android: Crash/Hung Issue

瘦欲@ 提交于 2019-12-02 08:21:01
问题 I followed THIS tutorial to set up a .NET Backend for my Android app to implement Signal R. I set up a SignalR Self-Hosted backend. Here's my Backend Code in a Console Project: namespace SignalRSelfHost { class Program { static void Main(string[] args) { // This will *ONLY* bind to localhost, if you want to bind to all addresses // use http://*:8080 to bind to all addresses. // See http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx // for more information. string url = "http

SignalR, JQuery and Node

依然范特西╮ 提交于 2019-12-02 05:26:32
问题 In a project I'm currently working on, we are using Electron as a host. In the Electron main process, which is a normal Node process we need to connect to a downstream back-end that has SignalR endpoints. However, since SignalR is a JQuery module and neither SignalR nor JQuery are supported on Node, we're a bit stuck. I see the following options: Look at some of the JQuery implementations in node and since we use webpack, inject that instead of the normal JQuery into SignalR Use an