javascript - How to unsubscribe from event handler in SignalR hub proxy? -
i working javascript signalr client. open hub connection like:
hubconnection = $.hubconnection(url); proxy= hubconnection.createhubproxy('somehub');
when want subscribe hub event:
proxy.on("someevent", function(somedata){ console.log(somedata); });
how unsubscribe listening hub event? tried proxy.off("someevent"); doesn't work.
use off
method:
var mycallback = function(somedata) { console.log(somedata); } proxy.on("someevent", mycallback); proxy.off("someevent", mycallback);
Comments
Post a Comment