Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR client calls fail for certain languages

I've been working on a project for a client and had a lot of fun integrating SignalR into the system.

Everything seems to work really well and the client is really excited about how the SignalR gives true real-time feedback for their application.

For the most part everything has gone swimmingly, however I've come into a strange issue I simply cannot pin down.

Everything works great for the following locales:

  1. en-US
  2. en-GB
  3. it
  4. nl

However these languages simply never get a callback from the hub:

  1. fr
  2. de
  3. es
  4. en-ZW - we use English Zimbabwe to check all the strings are translated.

I can step through the code right up until Clients.Client(ConnectionId).update(Result); (where ConnectionId is the correct Connection ID, and Result is the object ready to be serialized, with the first four languages this goes flawlessly and I get my Javascript method with the expected output.

On the last four languages however, the method is fired, but nothing comes through to the other side. Nothing. Zip.

If I replace the Strings.fr.resx file with the default Strings.resx then my site functions as expected, but since the Strings.en-ZW.resx file is identical to Strings.resx (only each string is wrapped in [()]) I doubt that is the issue. I also tried using the fr locale with all unicode translations (`, é, â, etc) removed, but that didn't help.

I've been going over this for almost a full day now and found nothing that would indicate the issue, and the fact that en works fine and en-ZW does not really confuses me.

Anyone have any suggestions?

Hub method:

public class ClientHub : Hub
{
    [...]

    protected void UpdateRecords(List<Int32> ChangedValues) 
    {
        using (var database = new DbContext())
        {
            foreach (Record R in database.Records.Where(Rc => ChangedValues.Contains(Rc.Id))
            {
                SignalRFormattedRecord Serialized = new SignalRFormattedRecord(Record);

                foreach (SavedFilter Filter in SavedFilters.ByRecord(Record))
                {
                    // Next line is always called.
                    Clients.Client(Filter.ConnectionId).updateRow(Serialized);
                }
            }
        }
    }

    [...]
}

Javascript:

$.connection.clientHub.updateRow = function(value) {
    debugger;
    // update code works in all languages except FR, DE, ES and en-ZW.
}

$.connection.start();
like image 283
Kristian Williams Avatar asked Oct 31 '22 15:10

Kristian Williams


1 Answers

Turns out the filtering system wasn't language agnostic where it should have been, and I was getting false positives due to dangling connections during debug.

I feel quite stupid now.

like image 101
Kristian Williams Avatar answered Nov 12 '22 19:11

Kristian Williams