Javascript SignalR interface documentation?

I’m sure I must be missing this but where is the documentation for the JavaScript SignalR interface? I’ve based my code on the example in the “Unified API Part 5: AoT – Arrivals of Things” post but cannot for the life of me find detailed documentation other than the extensive SignalR documents from MicroSoft.

Thanks

Hi @LeeMcL, I’m afraid the blog article is the most in-depth documentation we have on how to use SignalR from a third-party developer’s perspective.

If you have any specific questions we may be able to address them here?

Thanks Tim.

If there is no documentation is it meant for production use or is it still being worked on? If its not ready is there an alternative push system?

At the moment I’m testing on both Chrome and Firefox on a desktop with a good network connection. I’m just using a web page with the JS client embedded and basing it on the blog post and the SignalR doc’s from MS. But I’ve hit a number of odd issues.

  • Predictions are similar to StopPoint responses with mostly the same fields except all the field names begin with an uppercase letter. Is there a reason for the difference?
  • I have the SignalR debugging turned on so I can see connects/disconnects. If I loose the connection the built in SignalR reconnect mechanism claims to reconnect but I only get a couple of predictions and thats it. I’ve written some work-around code to stop/start the connection but I was wondering if I was missing something
  • Sometimes I just stop getting predictions. SignalR has not reported a lost connection. I just stop getting predictions. It happens maybe 3 or 4 times a day with no discernable pattern. It isn’t the stops I’m looking at becoming quiet nor is it my network connection. It I stop/start the connection it works again within seconds

Thanks

I don’t mean to bring up an old thread but I have a question regarding this. I’m using Svelte (JS Framework).

const signalR = window.$;
const hub = signalR.connection.predictionsRoomHub;
signalR.connection.hub.logging = true;
signalR.connection.hub.url = 'https://push-api.tfl.gov.uk/signalr/hubs/signalr';

signalR.connection.hub.start().done(() => {
    console.log('tfl.predictions: connection started');

    hub.server
        .addLineRooms(lineRooms)
        .done(function () {
            console.log('tfl.predictions: Invocation of addLineRooms succeeded');
            return;
        })
        .fail(function (error) {
            console.log('tfl.predictions: Invocation of addLineRooms failed. Error: ' + error);
            return;
        });
});
}

hub.client.showPredictions = function (data) {
    if(data) {
        // currentStation = groupBy2PropertiesDesc(data, 'LineId', 'PlatformName');
        console.log(data); 
        // data returns in sections at takes 10 seconds to load data in the first place
    }
};

How do I get showPredictions to return data straight away, so my app isn’t waiting and how do I get it to return all the data for one station rather that chunks of it?

1 Like