c# - ASP.NET MVC 5, SignalR 2.2.1 and Sessions. Using them to create a web chat -


i new asp.net mvc , signalr. have followed tutorials mvc , signalr catch foundations. searched, read , tested, nothing specific problem. try explain first time. trying create web chat program mvc , signalr. seems can not understood using of signalr , mvc , session handling.

i need follow user session , determine whether user logged in or not.

there function creating chat room (only logged users).

option (1) not logged in user:

the not logged in user must enter name have access of chat rooms. not able create new chat room.

option (2) logged in user:

the logged in user able create chat room. , join in other chat room.

questions:

  1. how creation of new chat room should accomplished?

    • create view new chat room dynamically in run time?
    • create 1 static view , use showing data (i mean following: users , rooms programmatically determine user in room is, filter other users, conversation , show content specific users in specific room in static view...)?
    • or else?
  2. how check if user logged in?

  3. how /and how much/ checking logged in user relevant signalr?
  4. how joining in chat room accomplished?
  5. should follow session not logged in user(s)?
  6. do need sessions kind of application everywhere or need sessions determine if user logged in or not logged in?
  7. should store messages directly db or must kind of buffer before inserting db? (lets have 600 000 people chatting @ same time, inserting directly in db cause database server "overheat"?)

i think now. edit if comes up...

thanks in advance try me.

those many questions @ same time. try , more specific or vague answers.

regarding main question, need learn signalr authentication , authorization

basically can add [authorize] attribute methods createroom want protect. available logged-in users. don´t need handle sessions or checking, signalr you.

methods not marked [authorize] "anonymous", meaning user can call them.

how joining in chat room accomplished?

you keep static list of clients each room , manage connections , disconnections yourself. or better yet, use signalr groups.

there awesome (and advanced) working chat application called jabbr.net made signalr. can grab source code , find answers there


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -