0

This is a statement from converse.js documentation.


auto_join_rooms

Default: []

This settings allows you to provide a list of groupchat conversations to be automatically joined once the user has logged in.

You can either specify a simple list of room JIDs, in which case your nickname will be taken from your JID, or you can specify a list of maps, where each map specifies the room’s JID and the nickname that should be used.

For example:

[{'jid': 'room@example.org', 'nick': 'WizardKing69' }]

How to add multiple values of the .I want to have 5 nics joined to the jid 'room@example.org'.I know this is a very simple question .But please help me

What i tried......

[{
  'jid': 'room@example.org',
  'nick': 'WizardKing69'
}, {
  'jid': 'room@example.org',
  'nick': 'WizardKing79'
}, {
  'jid': 'room@example.org',
  'nick': 'WizardKing89'
}]
sobha
  • 165
  • 1
  • 9

2 Answers2

0
[{'jid': 'room@example.org', 'nick': 'username1' },{'jid': 'room@example.org', 'nick': 'username2' }, {'jid': 'room@example.org', 'nick': 'username3' }, {'jid': 'room@example.org', 'nick': 'username4' }, {'jid': 'room@example.org', 'nick': 'username5' }]

Have you tried this?

maaajo
  • 839
  • 6
  • 10
  • @maajo I tried like this but it is showing only username1 as logged in [{'jid': 'anonymous@conference.nomnom.im', 'nick': 'username1' },{'jid': 'anonymous@conference.nomnom.im', 'nick': 'username2' }, {'jid': 'anonymous@conference.nomnom.im', 'nick': 'username3' }, {'jid': 'anonymous@conference.nomnom.im', 'nick': 'username4' }, {'jid': 'anonymous@conference.nomnom.im', 'nick': 'username5' }] – sobha May 14 '19 at 06:45
0

Provided your jid's are unique you can make the nick an array and add them using the below method:

const roomList = [...];
const addNick = (jid, nic) => {
    let room = roomList.find(rm=>rm.jid === jid);
    if(room) room.nick.push(nic);
    else console.error('Room not found');
} 
A Rogue Otaku
  • 913
  • 10
  • 20