signalr.client

Detecting when signalR hub is ready after hub.start()

血红的双手。 提交于 2019-12-11 19:34:45
问题 I have a parent and child viewModel. The parent viewmodel starts the signalR connection: $.connection.hub.start() The child viewmodel - one that loads only when the user accesses chat - does the following: chat.server.addUserToChat(self.currentUsername()).done(function() { alert('added'); }); The problem is, the child call is happening before the parent call. I can fix this with a setTimeOut of 1 second, but ideally I could do something like this: $.connection.hub.ready(function(){chat.server

SignalR .Net client fails to connect (upd: how to set auth. cookie?)

孤街醉人 提交于 2019-12-11 11:43:17
问题 This thing is dragging me nuts. I have a .net 4.0 console app and I have an MVC web app. javascript clients can connect and talk to the server - no problems here... but my .net client throws System.AggregateException with InnerException = "Unexpected character encountered while parsing value: <. Path... so I created an empty MVC3 app, added SignalR libraries, and .net client surprisingly connects to that. But for some reason it doesn't to the other one. I've checked everything, both MVC3 apps

Hub.start - wait for finish

纵饮孤独 提交于 2019-12-11 06:39:39
问题 I'm using SignalR to transferring commands from client to server without refreshing the page. When the client enter some of my web pages, I'm starting a new hub connection. Like this: var hub = $.connection.siteControllerHub; $.connection.hub.start(); This "start()" function takes some time (+-5 seconds). mean while, the page is already finished loading and the user start using my UI. SingalR cannot serve the user, until it's finish loading the connection. I'm know that I'm can use the async

Error sending object to .net signalr client

六月ゝ 毕业季﹏ 提交于 2019-12-11 03:09:25
问题 My understanding is that with signalr I can just send objects back and forth. I am trying to set up a .net client to receive notifications that orders have been placed on a web site. I am trying to set up a very simple example so that I understand the concepts. It works great when I am sending a string notification back to the client, but when I try to send an object I get an error: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException was unhandled by user code HResult=-2146233088 Message

Call .fail(error) without throwing exception

不问归期 提交于 2019-12-11 02:46:13
问题 Using SignalR, is there any possibility to call .fail instead of .done when specific values are returned by hub method? Perhaps using the SignalR pipeline? public bool Delete(int addressId) { // User should not be able to delete default address if(AddressService.IsDefaultAddressOfCustomer(addressId)) return false; // Should call .fail() on client AddressService.Delete(addressId); return true; // Should call .done() on client } The alternative would be to throw an exception but I would like to

How to check success of HubConnection.StartAsync in SignalR for ASP.NET Core 2.0?

ぃ、小莉子 提交于 2019-12-11 00:19:04
问题 Using SignalR for ASP.NET Core 2.0, Client side (1.0.0-alpha2-final), C# VS2017. To connect the code is: await hubConnection.StartAsync(); since this is an await for a void how can we test if the client did manage to connect ? In my tests I have a breakpoint on the server side in public override async Task OnConnectedAsync() but that breakpoint is not always hit therefore I know that sometimes the client does not connect. Or perhaps it did connect but OnConnectedAsync() was not triggered? How

SignalR v2.3.0 in Android

落爺英雄遲暮 提交于 2019-12-10 18:49:37
问题 I have a MVC .NET application that uses signalR. I tried to download this client: https://github.com/Gurgen/SignalR-.net-core-android-client I ran it on my device. Pressed the connect button. But kept getting an exception. Debugging it I found that I had to change this line String connectionId = jsonElement.getAsJsonObject().get("connectionId").getAsString(); to this String connectionId = jsonElement.getAsJsonObject().get("ConnectionId").getAsString(); I am already starting to feel like this

Authenticate a .NET Core 2.1 SignalR console client to a web app that uses “Identity as UI”

那年仲夏 提交于 2019-12-10 18:18:41
问题 Using .NET Core 2.1 & VS2017 preview 2 I created a simple web server with "Identity as UI" as explained here and then added a SignalR chat following this. In particular I have: app.UseAuthentication(); app.UseSignalR((options) => { options.MapHub<MyHub>("/hubs/myhub"); }); .. [Authorize] public class MyHub : Hub .. "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:5000", "sslPort": 0 I start the debugger which

Call SignalR Hub from Backend Business Layer

人盡茶涼 提交于 2019-12-10 16:36:27
问题 I have an MVC website sitting onto of some fairly hefty business objects. My MVC Controllers call Manager objects which conducts and delegates work off to other sets of objects. Basically the code is deep server side, while a Hub in a way is just like a Controller in that it is fairly close to the client side. Is there a way to execute SignalR methods based on a reference to the Hub passed to these Manager objects? 回答1: If your MVC and SignalR services are running on the same process, you can

Why is HTTPContext.Current.Session null using SignalR 2.x libraries in a ASP .Net MVC application?

爱⌒轻易说出口 提交于 2019-12-10 14:55:28
问题 I'm attempting to migrate our ASP.Net MVC application from using Signal R1.x tgo SignalR 2.x. I just found issue which will certainly cause us problems in our quest to move forward. Our web application is MVC based and makes heavy use of the HttpContext.Current.Session variable. When running with SignalR 1.x, everything is fine and dandy with Session. When we upgraded to SignalR 2.x, Session was suddenly null. I did a little googling and found the following links regarding the issue: