SignalR - few general questions

Created on 23 Mar 2018  路  10Comments  路  Source: SignalR/SignalR

  1. What is diffrence between SignalR/SignalR2 and asp.net signalR?
  2. What is main official page including documentation of that library. I found this page: https://www.asp.net/signalr which seems to have nice instructions but is it offcial one and up to date?
  3. I built simple chat/server based on signalR and users can communicate through main chat window, Is it possible every new user who joins channel to see all conversation alrrady existing? Simple saying to see all history for every new user joins?
  4. Comparing version 2.2.1 and 2.2.3 is ther any significant change especially related to async/await usage?

Most helpful comment

What is diffrence between SignalR/SignalR2 and asp.net signalR?

aspnet/SignalR is the ASP.NET Core version of SignalR.

What is main official page including documentation of that library. I found this page: https://www.asp.net/signalr which seems to have nice instructions but is it offcial one and up to date?

This is for the existing ASP.NET SignalR. https://docs.microsoft.com/en-us/aspnet/signalr/

The ASP.NET Core SignalR docs are here https://docs.microsoft.com/en-us/aspnet/core/signalr/get-started?tabs=visual-studio.

I built simple chat/server based on signalR and users can communicate through main chat window, Is it possible every new user who joins channel to see all conversation alrrady existing? Simple saying to see all history for every new user joins?

Yes, but you need to write that code. SignalR doesn't store messages, it just makes sure that connected parties see them. You need to store message history and reply it to the user.

Comparing version 2.2.1 and 2.2.3 is ther any significant change especially related to async/await usage?

No.

All 10 comments

What is diffrence between SignalR/SignalR2 and asp.net signalR?

aspnet/SignalR is the ASP.NET Core version of SignalR.

What is main official page including documentation of that library. I found this page: https://www.asp.net/signalr which seems to have nice instructions but is it offcial one and up to date?

This is for the existing ASP.NET SignalR. https://docs.microsoft.com/en-us/aspnet/signalr/

The ASP.NET Core SignalR docs are here https://docs.microsoft.com/en-us/aspnet/core/signalr/get-started?tabs=visual-studio.

I built simple chat/server based on signalR and users can communicate through main chat window, Is it possible every new user who joins channel to see all conversation alrrady existing? Simple saying to see all history for every new user joins?

Yes, but you need to write that code. SignalR doesn't store messages, it just makes sure that connected parties see them. You need to store message history and reply it to the user.

Comparing version 2.2.1 and 2.2.3 is ther any significant change especially related to async/await usage?

No.

Hi David, much apprciate your input. If possible, could you please answer on below once additionally?:

5) What about this website: https://www.asp.net/signalr ? Should i trade it obselete?

6) ASP.NET core you mean "core" - this related one to .Net Core Framework for instance to be used for Linux or Mac targeting Net Framework Core 2?

7) In ASP.NET core signal version i see "return Clients.All.SendAsync", however in regular .NET framework it's only like: Clients.All.MyCustomMessage (no SendAsync) option, can you explain why?

8) Right now i am using static list to store every new user joined/left on server side. Everytime i send to all users actual list information to update their list in GUI app every time users leave/join. Do you think it's good to do the same for chat history therefore every new user joining chat- server send him list of chat history. What do you think? I am just not sure about performance if chat history is big. Maybe it's good to store chat in database for old mesages for instance > 5 days and just store in file up to 5 days.

9) Related to above point - why when i use static list i keeps items in it and when i use noon static it always become empty especially when trying to access in OnConnected/OnDisconnected list was empty.

10) Currently i have one HUB class. I heard that i could have more HUBs. Is it like - ok i can create second Hub2 along with Hub1 - could it be that second Hub would have other chat and clients could choose/switch which one to connect? And does server on same link: const string ServerUri = "http://localhost:8080/signalr"; can handle multiple hubs? Is that correct thinking? Morover if all that is true can one client connect to many hubs? If so what about connection ids? For each hub diffrent connection id will be associated with that user?

11) Can i use SignalR in commerce applciation and is it know Microsoft belongs? If so where is any license or whatever i could show end client about this library to confirm that.

P.S Keep your work, signalR is great !

What about this website: https://www.asp.net/signalr ? Should i trade it obselete?

@rachelappel Any ideas? I think we're basically moving all docs to docs.microsoft.com but I don't know the current state of moving SignalR for ASP.NET docs.

ASP.NET core you mean "core" - this related one to .Net Core Framework for instance to be used for Linux or Mac targeting Net Framework Core 2?

ASP.NET Core runs on .NET Framework (4.6 and above) and .NET Core. SignalR on ASP.NET Core is slated for the .NET Core 2.1 release.

In ASP.NET core signal version i see "return Clients.All.SendAsync", however in regular .NET framework it's only like: Clients.All.MyCustomMessage (no SendAsync) option, can you explain why?

We changed the API. We moved away from dynamic because there are too many limitations and things you can't express. If you want the old syntax you can derive from DynamicHub.

Right now i am using static list to store every new user joined/left on server side. Everytime i send to all users actual list information to update their list in GUI app every time users leave/join. Do you think it's good to do the same for chat history therefore every new user joining chat- server send him list of chat history. What do you think?

Do you care about chat messages being persisted across application restarts? If yes then you can't store them in memory. You'll need a database.

I am just not sure about performance if chat history is big. Maybe it's good to store chat in database for old mesages for instance > 5 days and just store in file up to 5 days.

Using a database with the right indexes should scale fine.

Related to above point - why when i use static list i keeps items in it and when i use noon static it always become empty especially when trying to access in OnConnected/OnDisconnected list was empty.

Hub instances are created per invocation of the hub method. You can't store fields in the hub that you want to persist.

Related to above point - why when i use static list i keeps items in it and when i use noon static it always become empty especially when trying to access in OnConnected/OnDisconnected list was empty.

Currently i have one HUB class. I heard that i could have more HUBs. Is it like - ok i can create second Hub2 along with Hub1 - could it be that second Hub would have other chat and clients could choose/switch which one to connect? And does server on same link: const string ServerUri = "http://localhost:8080/signalr"; can handle multiple hubs? Is that correct thinking? Morover if all that is true can one client connect to many hubs? If so what about connection ids? For each hub diffrent connection id will be associated with that user?

In SignalR (non core) all hubs are multiplexed over a single connection so no. Connections are shared across the hubs and you can't "connect" to a specific hub. You can just choose to have that connection only get messages from a particular hub. On the flip side, this is possible with ASP.NET Core SignalR since it was a design change we made (Hubs are unique things that are mapped to specific URLs).

Can i use SignalR in commerce applciation and is it know Microsoft belongs? If so where is any license or whatever i could show end client about this library to confirm that.

I don't know what you mean.

We changed the API. We moved away from dynamic because there are too many limitations and things you can't express. If you want the old syntax you can derive from DynamicHub.

Does it mean that Clients.All. means CLisnt.All is just enough and having implemented inside asynchronous and is most recent approach?

About licensing - simple saying can i use SignalR in my application? This application will be sell.

Does it mean that Clients.All. means CLisnt.All is just enough and having implemented inside asynchronous and is most recent approach?

Not sure what you mean. They're both async but the dynamic

About licensing - simple saying can i use SignalR in my application? This application will be sell.

Yes. https://github.com/SignalR/SignalR/blob/dev/LICENSE.txt

I just updated to most recent version and it seems than now i am able to do like this:

  public async void SendNewUserJoined(string userName, string userId)
  {
        await   Clients.All.SendNewUserJoined(userName, userId);
   }

but before that update i wasn't able to use await on Clients.. Does it mean that it was done synchronously?

Don't do async void. Do async Task.

yes i know that - just typo. Nevertheless could you answer on my question plz?

So far yes, all the new docs for SignalR on ASP.NET Core will be at https://docs.microsoft.com/en-us/aspnet/core/signalr/introduction
We are expecting the rest of the docs to roll out over the next month or so and in time for BUILD

The current docset for SignalR on .NET Framework is at https://docs.microsoft.com/en-us/aspnet/signalr/overview/getting-started/introduction-to-signalr The www.asp.net/signalr site redirects to there.

fine then i assume previous page is obsolete officialy.

Was this page helpful?
0 / 5 - 0 ratings