My problem is related to disconnect event of Faye. I can easily subscribe to a channel from java script and i can also handle the /meta/subscribe
and /meta/connect
. But I want some thing like a button in my html.erb file and using that i want to disconnect or unsubscribe from the channel. I want to know how do i fire up a java script for disconnecting from the channel like we do while subscribing to a channel as given below:
$(function() {
var faye = new Faye.Client('http://localhost:9292/faye');
faye.subscribe("/messages/new", function(data) {
eval(data);
});
});
please provide me a controller code or java script code. Thanks