c# - Can multiple views connect to single hub class in signalR -
i have hub class chathub.cs ,i have fetched data view1 same connection made on view1 hub class ,is possible use same connection in view2 pass data chathub view2
yes! possible share updates on different view pages 1 single hub. can assign same chathub both view pages this:
var chat = $.connection.chathub; then can send update first view hub method lets
client.all.sendupdate(name,message); where sendupdate mentioned in second view js
chat.client.sendupdate =function (name, message) { $('#discussion').append('<li><strong>' + htmlencode(name) + '</strong>: ' + htmlencode(message) + '</li>'); };
Comments
Post a Comment