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

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -