我正在尝试实现简单的 stanzajs 群聊,但在测试中它从变量和到变量都不清楚。
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)
});