0
votes

I develop SignalR (1.1.2) chat for our corporative site (ASP.NET) and I don't know how place it for almost all pages of site. I have the next questions:

  1. Online/offline states of users change when users move on other page.

    In my chat state setting performs on OnConnected/Ondisconnected callbacks in my Hub class and it call when users move on other page.

  2. Should I initialize SignalR with $.connection.hub.start().done on ALL pages? May be are there workarounds?

  3. What does cross-domain mean? I don't understand this definition.

  4. What logic should I move in OnReconnected callback in my Hub class?

Thanks in advance.

1

1 Answers

3
votes

Sounds like you are trying to use SignalR in the wrong way.

You are going to have to start the hub every time you change page unless your application is a single page application. E.g. All run via JavaScript on one page.

When you change page, you are effectively closing down the SignalR connection to the hub, then you will need to start it on the next page. This will raise the Disconnect event.

Each time you connect, your user will be given a new ConnectionID, so their online/offline status will change depending on how you are handling this.

The only work around would be to create a Single Page application.

Cross-Domain means that you are calling the SignalR methods on another URL from the client.

Within your OnReconnected callback you might want to just write some logic that notifys a user that they have been reconnected.