c# - Signalr Winform Callback -


i experimenting signalr hubs , created small app push messages external hub. create proxy , connect hub , can invoke method want.

  initializecomponent();          connection = new hubconnection("http://externalsite.net");          myhub = connection.createproxy("webhub");          if (connection.state.tostring() != "connected")         {             connection.connectionid = "adminconsole";              console.writeline("attempting connect...");             connection.start().continuewith(task =>             {                  console.writeline("attempting connect");                 if (task.isfaulted)                 {                     console.writeline("error opening connection:{0}"                      task.exception.getbaseexception());                 }                 else                 {                      console.writeline("client connected");                  }             }).wait();         } 

then can use "myhub.invoke(method)"

on hub have methods connected clients , can update web page how go subscribing or informing app of these events?.

e.g method on hub:

public void send(string message, string name) {

        clients.all.broadcast(message, name);     } 

all clients receive message, how app receive also?. possible ?, can app poll changes far ideal.

update: have tried attach on<> method below no luck either.

myhub.on<vmessage>("send", message =>             textbox1.text += string.format("message update            {0} message : {1}\n", message.enginename, message.vmsg)             ); 


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -