signalr.client

Android client for SignalR does not receive but JS does

我怕爱的太早我们不能终老 提交于 2019-12-05 13:47:52
This is a "hello world" app but I can't find the solution. This is the code on the client: public class MainActivity extends ActionBarActivity { HubProxy proxy; EditText messageText; TextView resultText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Platform.loadPlatformComponent(new AndroidPlatformComponent()); //Setup connection String server = "http://10.0.2.2:8081/"; HubConnection connection = new HubConnection(server); proxy = connection.createHubProxy("chatHub"); Toast.makeText

SignalR connect to multiple servers

半城伤御伤魂 提交于 2019-12-05 13:44:21
Is possible to connect using Javascript client to more than one SignalR servers? For example: <script type="text/javascript"> $.connection.hub.url = 'http://server1.net/signalr'; var server1Hub = $.connection.server1Hub; $.connection.hub.start().done(function () { }); // i need to connect to server2 $.connection.hub.url = 'http://server2.net/signalr'; var server2Hub = $.connection.server2Hub; $.connection.hub.start().done(function () { }); </script> Trying to connect (again) the second time gives me an error: 'server1Hub' Hub could not be resolved. Can i create two instances of $.connection ?

How to use async/await with hub.On in SignalR client

独自空忆成欢 提交于 2019-12-05 04:12:55
I have a .Net Windows Service (client) that's communicating with a SignalR Hub (server). Most of the client methods will take time to complete. When receiving a call from the server, how do I (or do I need to) wrap the target method/hub.On to avoid the warning: "Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the await operator to the result of the call" On the client, this is a sample of the start up / setup code: IHubProxy _hub string hubUrl = @"http://localhost/"; var connection = new HubConnection(hubUrl, hubParams

Use of /signalr/ping call when using long polling

时间秒杀一切 提交于 2019-12-05 01:23:35
I'm using long polling with SignalR. I've found that user session ends (ASP.NET Session_End is being called) right after singalr based webpage makes /signar/ping request ( as shown in this screenshot ). I went through http://www.asp.net/signalr/overview/signalr-20/hubs-api/handling-connection-lifetime-events but couldn't figure out clear answers following questions. How to keep ASP.net user session alive from a signalr client webpage? What is the actual purpose of /ping? Is the timing for this /ping call configurable? The entire purpose of the /signalr/ping request is to keep ASP.NET sessions

SignalR authentication failed when passing “Bearer” through query string

China☆狼群 提交于 2019-12-05 00:08:33
问题 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

SignalR: Hub OnConnected not called if no client methods

。_饼干妹妹 提交于 2019-12-04 17:09:45
问题 I am writing a game in SignalR. The idea is that you connect with your laptop, which will be used as "display" and then you connect with your smart phone and that will be used as "joystick". The entire setup works very well. Now that it all works, I decided to refactor the code. I realized that the relationship between the joystick and the display is one way (the display never needs to send information back to the joystick). Therefore I decided that I did not need any signalR invokable client

SignalR Client How to Set user when start connection?

喜欢而已 提交于 2019-12-04 11:20:49
问题 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

Can I reduce the Circular Buffer to “1”? Is that a good idea?

大兔子大兔子 提交于 2019-12-04 10:07:44
By default, there are a default of 1,000 messages stored in the ring buffer on the server. It doesn't make sense for me to send a lagging client 1,000 updates, but rather just the most recent update. In WCF I can do this by using volatile data. I suppose I can emulate a volatile approach by reducing the buffer to "1", but not sure if this can be configured on a per hub basis, or ideally, on a per method basis. Does it matter if I use hubs or persistent connections with this? Even if you set the DefaultMessageBufferSize to 1, SignalR ensures each buffer will hold at least 32 messages. The

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

SignalR .NET Client doesn't support WebSockets on Windows 7

我怕爱的太早我们不能终老 提交于 2019-12-04 05:23:58
I've written a small echo-server (.net 4.5), console client (.net 4.5) and web client using SignalR and example presented here . Server is hosted in IIS8/Win8. Then I ran both clients on Win7. and I see that web client in Chrome uses webSockets, while console app client uses serverSentEvents. If I run console client on Win8, then webSockets transport is in use. Is it true that SignalR .NET client will use webSockets only on Win8 and higher? It's correct: .NET client uses WebSockets only on Win8 and higher. For a project I had to use real websocket connections in combination with SignalR. For