SignalR not firing all client events

This is more for my own reference, so I can come back to it later, hopefully its also helpful to others.

I saw some odd behaviour with SignalR where a client was not receiving messages from the server or would fire some client messages but not others. Refreshing the page solves it but on the first time visit to the page the problem starts again.

After a lot of debugging it appears the problem is caused by placing your SignalR client code after the connect start code in your client. So if you are using a JavaScript client, ensure you place the SignalR connection start code after all of your SignalR client code.