我的客户没有收到带有pusher和symfony的数据

时间:2019-03-26 13:48:53

标签: symfony client pusher-js

我在Symfony中处理通知,我在pusher中创建了一个帐户,但是当我测试我的广播时,它返回状态200,但我的客户未收到数据,感谢您的帮助 来自控制台行的消息

Pusher : State changed : connecting -> connected with new socket ID 
126177.5282876
pusher.min.js:8 Pusher : Event sent : 
{"event":"pusher:ping","data":{}}
pusher.min.js:8 Pusher : Event recd : 
 {"event":"pusher:pong","data":{}}

命令行消息

Pushing message ...
string(270) "Pusher: INFO: create_curl( http://api- 
eu.pusher.com:80/apps/173/events? 

  auth_key=a3ab9880a251ef5134bed9 )"
  string(115) "Pusher: INFO: trigger POST: {"name":"my- 
  event","data":"{\"test-message\":\"Your message\"}","channels": 
  ["channel"]}"
  string(40) "Pusher: INFO: exec_curl 200 response: {}"
  string(81) "Pusher: INFO: exec_curl response: Array
  (
  [body] => {}
  [status] => 200
  )
  "

我正在使用以下代码进行测试:

{# Call NotificationsBundles's assets #}
{{ notifications_assets() }}
<script>
/**
 * After calling notifications_assets() "pusher" is now available
 * and you can use it this way
 */

    // select the channel you want to listen to
var channel = pusher.subscribe("notifications");// notifications 
channel
channel.bind("my-event", function(data) {
    console.log('from notifications channel', data);
 });

 var channel = pusher.subscribe("messages");// messages channel
 channel.bind("my-event", function(data) {
    console.log('from messages channel', data);
 });

0 个答案:

没有答案