I am trying to implement simple stanzajs groupchat but in tests its unclear from and to variables.
test('MUC chat', () => {
const client = createClient({});
const incoming: ReceivedMessage = {
body: 'yayyyy',
from: '[email protected]/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 there is no errors, but the other user and room cant see the message. How can I send a public message to room. i dont understand why to: variable is a user rather then room name
this.client.on('groupchat', msg => {
console.log("groupchat new")
console.log(msg)
});
Only an account that joined the room (an occupant in the room) can send messages to the room.
You should install a well known Jabber/XMPP client, for example Gajim, Psi, Tkabber... Those clients have a "XML console" that allows you to see what stanzas they send and receive.
Compare what they send with what you are sending, and you will find the probem.