Is there a way to get database's exist fields and new fields with SignalR?
I would like to make a multi chat application with MVC; and I would like to store all messages etc. in sql server database...
Planned rotation of the data will be client=>sql server=>client...
The technology is new or unknown so I couldn't find smart examples...
check this article and you should be able to save all incomming messages to DB on OnReceivedAsync Method.
http://visualstudiomagazine.com/articles/2013/01/22/build-a-signal-r-app-part-1.aspx
if you need to send last 20 records to any specific user or broadcast you can use below statement once you fetched last 20 records from you DB.
Connection.Broadcast(chatData); // this will broadcast data to all connected clients.
protected override Task OnConnectedAsync(IRequest request, string connectionId)
{
_clients.Add(connectionId, string.Empty);
ChatData chatData = new ChatData("Server", "A new user has joined the room.");
return Connection.Broadcast(chatData);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.