php - 向除发件人以外的所有用户发布消息
问题描述
我正在使用 GosWebSocketBundle ( https://github.com/GeniusesOfSymfony/WebSocketBundle ) 发送通知/消息。我已经参考了文档并完成了向公共频道的所有订阅者广播消息的工作。但我不希望发件人收到它自己的消息。请帮我。
public function onSubscribe(ConnectionInterface $connection, Topic $topic, WampRequest $request)
{
//this will broadcast the message to ALL subscribers of this topic.
$topic->broadcast(['msg' => $connection->resourceId . " has joined " . $topic->getId()]);
}
public function onPublish(ConnectionInterface $connection, Topic $topic, WampRequest $request, $event, array $exclude, array $eligible)
{
$topic->broadcast(['msg' => $event]);
}
解决方案
推荐阅读
- java - 填充有 Firebase 数据库的 Android 微调器未选择该项目
- spring-mvc - 什么时候调用 DispatcherServlet 的 onRefresh 方法?
- python - 使用 Python - 设置列表来存储 30 个学生姓氏以及 test1 和 test2 的测试分数,这两个分数都是 50
- matlab - 如何使用图形作为函数来获得输出?
- javascript - 如何在 Angular CLI 6 项目中添加 js 库?
- c# - Application deployed on server won't work as on local machine
- javascript - Internet Explorer CSS 转换问题
- ios - React-native bridge is nil when method called from Swift ViewController
- fortran - 为什么我应该在 Fortran 中使用“仅使用”
- html - SASS 未定义变量问题