【发布时间】:2021-02-22 19:15:49
【问题描述】:
我正在尝试实现简单的 stanzajs 群聊,但在测试中它不清楚 from 和 to 变量。
test('MUC chat', () => {
const client = createClient({});
const incoming: ReceivedMessage = {
body: 'yayyyy',
from: 'room@rooms.test/member',
to: 'tester@localhost',
type: 'groupchat'
};
client.on('groupchat', msg => {
expect(msg).toStrictEqual(incoming);
});
client.emit('message', incoming);
});
https://github.com/legastero/stanza/blob/master/test/muc/messages.ts 没有错误,但其他用户和房间看不到该消息。如何向房间发送公共消息。我不明白为什么:变量是用户而不是房间名称
this.client.on('groupchat', msg => {
console.log("groupchat new")
console.log(msg)
});
【问题讨论】: