c# - Create proxy with signalR -
i'm working on signalr website , signalr client console app connects signalr server having problems connecting.
i noticed in tutorials , other topics using "createproxy" method don't have method, can't find in object browser either.
my question if there replacement method , if there isn't how suppose tell signalr hub connect too?
code:
connection = new hubconnection(geturl()); while (connection.state != connectionstate.connected) { var connectiontask = connection.start().continuewith(task => { if (connection.state == connectionstate.connected) { console.writeline("succesvol verbonden!"); // subscribe receive messages connection.received += connection_received; } else { console.writeline("het niet gelukt om te verbinden!"); } }); // wait till outcome connectiontask.wait(); // check if succesfully connected if (connection.state != connectionstate.connected) { connection = new connection(geturl()); } else { // send message connection.send("hallooo!").continuewith(sendtask => { if (connectiontask.isfaulted) { console.writeline("het niet gelukt om een bericht te versturen!"); } }); } }
i'm guessing connection property not of type hubconnection of type connection or iconnection maybe?
if that's case, should first cast connection type hubconnection able use createhubproxy():
connection = new hubconnection(geturl()); var hubproxy = ((hubconnection) connection).createhubproxy("yourhubname");
Comments
Post a Comment