locked
Group broadcast inconsitencies RRS feed

  • Question

  • User660101893 posted

    I have signalr 2.1.1.0 running on Azure server

    Here is my server code for MessageHub: Hub 

    Startup.cs has 

            {
               app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
     
                app.MapSignalR();
            }

            public Task Join(string name)
            {
                //maybe check that it is a valid center?
                return Groups.Add(Context.ConnectionId, name);
            }
    
            public void SendMessage(string name, string message)
            {
                Clients.Group(name).OnMessageSent(message);
            }

    I have 2 separate clients connecting. One client will register to join group "foo" (ClientA-foo) and the other will join group "bar" (clientB-bar). Both clients are .Net-based and running the latest version of the signalr client (2.2.1.0).  One client is a console app (clientB-bar), the other is running Windows 10 IoT Core on a Rasp Pi 3 (clientA-foo).

    When I have clientA-foo Invoke SendMessage("bar", "Hello") from its proxy, my ClientB-bar doesn't always get the message on the On(OnMessageSent). Again, its random...Sometimes its works and sometimes its doesn't.   Is there something I am missing to make it more consistent?

    Here is ClientA-foo call

                List<string> l = new List<string>();
                            l.Add("bar";
                            l.Add("some message");
                       
                            await _proxy.Invoke("SendMessage",l.ToArray());

    Here is clientB-bar listener

           rproxy.On("OnMessageSent", (x) =>
                    {
                        Console.WriteLine(x);
    
                    });

    Tuesday, August 16, 2016 8:09 PM

Answers

All replies

  • User61956409 posted

    Hi boblautenbach,

    Firstly, you could refer to the following article to enable tracing and view diagnostic information.

    http://www.asp.net/signalr/overview/testing-and-debugging/enabling-signalr-tracing

    Secondly, it seems that Azure enable remote debugging, you could check if hub methods could be fire as expected.  

    Best Regards,

    Fei Han

    Friday, August 19, 2016 2:31 AM
  • User660101893 posted

    Thanks..did both.  Actually 'tailed" the traces to my log pc to watch.  The hub methods are being called but it seems like the hub thinks the 2 clients are not in the same group (which they are).

    Here's a test client ....Spin up one and then spin up a second one.  You may have to spin up and shut down the second one a few times to see this issue but eventually you will see it.

    https://github.com/boblautenbach/signarlGroups

    Friday, August 19, 2016 2:33 AM
  • User660101893 posted

    Is it at all possible that the Server Hub is creating multiple instance of itself, thereby causing some connections to join the group in one instance and other connections to join the group in another instance.  For example, as I type this, I have 4 console apps up running: console1 and console3 can send and receive messages to/from group "foo" and console2 and console4 can send and send/receive to/from group "foo".  But they only work in those pairs, meaning all 4 of the console apps should see all the messages (they are in the same group) but that is not happening.  Its as if each pair of consoles apps is connected to a completely different hub instance.

    Friday, August 19, 2016 3:31 PM
  • User660101893 posted

    Researched more and found the answer.  Posted the details here: http://stackoverflow.com/questions/39129372/signalr-groups-not-always-communicating

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 29, 2016 1:13 PM