我已经建立了一个像这里这样的小型聊天应用程序: https ://github.com/chrismccord/phoenix_chat_example/blob/master/web/channels/room_channel.ex
并且无法弄清楚如何在一个主题中向所有用户广播一条消息。在上面的应用程序中(没有像我使用的那样更新到 v0.13),我该怎么做?以下是我没有运气的尝试:
Phoenix.PubSub.broadcast Chat.PubSub, "new:msg", "hello from the console"
Phoenix.PubSub.broadcast Chat.Endpoint, "new:msg", "hello from the console"
Phoenix.PubSub.broadcast Chat.RoomChannel, "new:msg", "hello from the console"
它们都不起作用......其中一些抛出异常:(