admin管理员组文章数量:1395436
I am using Pusher for real-time page update for my static JavaScript app. when i tried to invoke trigger event its not responding anythin. here is my code
var pusher = new Pusher('5f5ebdf0612fbafff349');
var myChannel = pusher.subscribe('channel_1')
myChannel.trigger("say_hello", {'name':"Jai", 'age':22});
I am using Pusher for real-time page update for my static JavaScript app. when i tried to invoke trigger event its not responding anythin. here is my code
var pusher = new Pusher('5f5ebdf0612fbafff349');
var myChannel = pusher.subscribe('channel_1')
myChannel.trigger("say_hello", {'name':"Jai", 'age':22});
Share
Improve this question
edited Jun 12, 2011 at 22:25
Soufiane Hassou
17.7k2 gold badges41 silver badges76 bronze badges
asked Jun 12, 2011 at 22:23
Jai KeerthiJai Keerthi
5,6052 gold badges18 silver badges9 bronze badges
2
- 5 You may want to remove your Pusher API key from the posted code, just FYI :) – Tak Commented Jun 12, 2011 at 22:35
- Can you elaborate on error messages or debug output? Your code looks okay. Can you see the event in the Pusher web console? – Tak Commented Jun 12, 2011 at 23:36
1 Answer
Reset to default 6You can only trigger events Using JS ( It is not advisable until you clearly know what you are doing) once you have a subscription successfully registered with Pusher for Client Side Triggers.
It is important that you apply additional care when binding to client- prefixed events, since these originate from other users (client side), and could be subject to tampering by a malicious user of your site (any one can modify and execute your JS).
Read this for getting acces to client side event triggering: http://pusher./docs/client_api_guide/client_events#trigger-events
本文标签: jqueryTrigger Pusher event from javascriptStack Overflow
版权声明:本文标题:jquery - Trigger Pusher event from javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744112466a2591350.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论