admin管理员组文章数量:1395730
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
本文标签: javascriptpushersubcribe() is not a functionStack Overflow
版权声明:本文标题:javascript - pusher.subcribe() is not a function - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744117067a2591563.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论