signalr

Detect 'server offline' with SignalR

梦想的初衷 提交于 2019-12-23 11:40:47
问题 We are attempting to use SignalR in an low-bandwidth environment where the connection to the backend server can come and go randomly, and we want our web application to respond appropriately. It looks like this connection API has been in flux over the past year, but in accordance with the latest documentation, I have tried hooking up to $.connection.hub.stateChanged to detect changes in the connection status, and I get a couple hits on startup when the client goes from disconnected ->

different connection in Browser multiple tabs

杀马特。学长 韩版系。学妹 提交于 2019-12-23 10:25:22
问题 Why SignalR is making different connection in browser multiple tabs for same logged-in user. Is there any way to make one connection for all tabs opened in same browser. From connection I mean connectionID of a user in SignalR. 回答1: Because different tabs of the same browser are different documents\"processes" - each tab in some sense represents different "instance" of client app. There is no way to share JavaScript objects between them directly (and thats the reason why SignalR opens new

Can a SignalR message loss be detected server side?

一曲冷凌霜 提交于 2019-12-23 09:32:38
问题 It seems that a SignalR server can throw away messages before they are sent to the client if its internal buffer overflows (see https://github.com/SignalR/SignalR/issues/2075). Currently we add a sequence number to all messages to let the client detect missing messages, but we would rather detect a message loss on the server and handle it there. Is that possible? 回答1: The way SignalR handles messages is inherently asynchronous and stateless. There is no built-in mechanism for the server to

OWIN Stop Server\Service?

巧了我就是萌 提交于 2019-12-23 09:32:23
问题 Using a c# winforms app to start owin Created a Startup config file [assembly: OwinStartup(typeof(Chatter.Host.Startup))] namespace Chatter.Host { public class Startup { public void Configuration(IAppBuilder app) { // Any connection or hub wire up and configuration should go here app.MapSignalR(); } } And then on my windows form: private void StartServer() { try { SignalR = WebApp.Start(URL); } catch (TargetInvocationException) { //Todo } this.Invoke((Action) (() => richTextBox1.AppendText(

Using ServiceStack.Text as JSON Serializer for SignalR

南笙酒味 提交于 2019-12-23 07:56:01
问题 To have consistent serialization across my application layers, I want to use the same Serialization library (ServiceStack.Text) for SignalR that I use everywhere else. While following SignalR's Wiki entry for replacing the used JSON Serializer, I created this basic handler: public class SignalrServiceStackJsonSerializer : IJsonSerializer { public void Serialize(object value, TextWriter writer) { var selfSerializer = value as IJsonWritable; if (selfSerializer != null) selfSerializer.WriteJson

SignalR performance

南笙酒味 提交于 2019-12-23 07:50:39
问题 We have a web-based game (SignalR for communication), our workload will be: 5,000 - 20,000 concurrent client with 0.5 - 2 messages/client/second ~= 10-40k messages/secs with the following server is there any problem handle the load (assume that signalr has 80-90% cpu) ? dual hex-cores L5639 (2.13Ghz) 24G Ram windows server 2012 standard (with long-polling we can easily do that @ 5-10% cpu) 回答1: As much as I dont want to write it, "it depends" is very much accurate here. SignalR can scale way

Send a message to all clients in a Group, except for the current client

天大地大妈咪最大 提交于 2019-12-23 07:27:35
问题 I want to execute a method on all connected clients from the server, except for the current client. Any way to do this without me maintaining my own list of clientids? TIA! 回答1: You can use Clients.OthersInGroup() method. 回答2: This functionality has been proposed and discussed on the github issues list for the project, but is not yet implemented http://goo.gl/pyMwF. For now, you will need to do your own filtering of your clients. 来源: https://stackoverflow.com/questions/10146961/send-a-message

Simple Injector registration problem in SignalR

主宰稳场 提交于 2019-12-23 07:03:08
问题 I set DI in my Controller as shown below and tied to register IHubContext as it seen on Controller: public class DemoController : Controller { private IHubContext<DemoHub> context; public DemoController(IHubContext<DemoHub> context) { this.context = context; } } Global.asax: protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); BundleConfig.RegisterBundles(BundleTable

SignalR Adding/Removing Connections from a dictionary and finding Group values from dictionary

北慕城南 提交于 2019-12-23 05:22:48
问题 I have Organizations that login to an asp.net website and when each member logs in I add their ConnectionId and OrganizationId to a static ConcurrentDictionary named OrganizationMembers in a SignalR Hub OnConnected override. I do this so I can send data to a page callback function that contains data relative only to that Organization (SignalR Group). The OrganizationId will represent the SignalR Group that I send data to. Also in the OnConnnected method, I add the OrganizationId and

How to create a local Windows-based service bus outside of Azure, similar to Redis with automatic fail-over?

故事扮演 提交于 2019-12-23 05:02:01
问题 We are implementing a service/message-bus feature in our SignalR application and have been looking at Redis, with automatic fail-over using Redis Sentiel. We would like to maintain our own servers and have read SignalR powered by Service Bus. Since this is a Winddows Azure implementation, how can I accomplish this in our internal network with VM's with automatic fail-over similar to the Redis solution discussed above? 回答1: You may want to look at Service Bus for Windows Server: http://msdn