How do I create the relationship between the support team member and partner user in my chatHub and then save the messages that they have sent to one another in my SQL database. Note, I am using ASP.NET identity framework for my user roles and rights.
The issue that I am currently facing is establishing a relationship between the partner user and the support team member. I am also unsure of how to store the messages that are sent on the localhost in the database. Sending the messages to and from the localhosts is simple enough, but establishing the relationship between the specific support team member and the partner user is where things get tough. Note that I am using the ASP.NET identity framework in my project.
I am attempting to create a conversation subsystem within the current subsystem. The basic logical of the subsystem is as follows:
The ticket gets logged by the chatBot for the specific partner user.
The Ticket is assigned to a random support team member.
The support team member is notified that the ticket has been assigned to him and is prompted to start a conversation with the specific partner user.
The support team member views the chat subsystem where they can see all of the chats that they have had and the new partner user with whom they have to communicate.
The support team member enters the chat and starts the "support-conversation" with the partner user.
At the end of the conversation the partner user can submit feedback of the specific support-team member with which they had a conversation.
The implementation of the subsystem is similar to the following code that I found at GitHub - Limon-7/SignalRChat
If you require any further clarification please ask :) Any help is greatly appreciated.
What I have tried:
public class ChatHub : Hub
private readonly AppDbContext _dbContext;
private readonly UserManager<ApplicationUser> _userManager;
private readonly Support_Conversation _conversation;
public ChatHub(AppDbContext dbContext, UserManager<ApplicationUser> userManager, Support_Conversation conversation)
_dbContext = dbContext;
_userManager = userManager;
_conversation = conversation;
public async Task SendMessage(string message, string receiverId)
var id = _conversation.SenderId;
message = _conversation.support_conversation_message;
var senderId = _userManager.FindByIdAsync(id).ToString();
var chat = await _dbContext.Support_Conversations.FirstOrDefaultAsync(c => (c.SenderId == senderId && c.ReceiverId == receiverId) || (c.SenderId == receiverId && c.ReceiverId == senderId));
if (chat == null)
chat = new Support_Conversation
SenderId = senderId,
ReceiverId = receiverId
await Clients.All.SendAsync("ReceiveMessage", message, senderId);
What I am attempting to do in the ChatHub is link the partner user and the support team member by their respective id's.
public class ConverstationController : Controller