pusher.trigger('test_channel', 'my_evenHt', {"message": "hello world"});
var channel = pusher.subscribe('test_channel');
channel.bind('my-event', function(data) {
alert('An event was triggered with message: ' + data.message);
});
pusher.trigger('test_channel', 'my_event', {"message": "hello world"});
I've initialized pusher at the top of the file. Here is the internals of a method thats throwing the error. The pusher.trigger()
function works correctly, but the next line throws an error on pusher.subcribe();
TypeError: pusher.subscribe is not a function
Why would this be happening?
pusher.trigger('test_channel', 'my_evenHt', {"message": "hello world"});
var channel = pusher.subscribe('test_channel');
channel.bind('my-event', function(data) {
alert('An event was triggered with message: ' + data.message);
});
pusher.trigger('test_channel', 'my_event', {"message": "hello world"});
I've initialized pusher at the top of the file. Here is the internals of a method thats throwing the error. The pusher.trigger()
function works correctly, but the next line throws an error on pusher.subcribe();
TypeError: pusher.subscribe is not a function
Why would this be happening?
Share Improve this question asked Jun 13, 2016 at 7:15 OrbitOrbit 2,39510 gold badges55 silver badges110 bronze badges2 Answers
Reset to default 8I assume you're using pusher-http-node? Pusher-http-node does not have the subscribe function, as it is a server http library.
If you wish to use our JS websocket library on the server, you can npm install pusher-js
, and import pusher-js/node
.
Thanks
You have to pass the API key for channel subscribe the channel.
https://github./dirkbonhomme/pusher-client-node#global-events