In my app i am using a 3 party Library returns the map like this
public sids: Map<SocketId, Set<Room>> = new Map();
and when i access it like this
io.of("/").adapter.sids.forEach(function(value, key) {
console.log(key + ' = ' + value)
})
the output looks like this..
qZq18yG3TkoBPXNTAAAC = [object Set]
84q_yQYKB7JjOPAIAAAD = [object Set]
and when i log the whole map i get this..
Map(2) {
'qZq18yG3TkoBPXNTAAAC' => Set(2) { 'qZq18yG3TkoBPXNTAAAC', 'demo' },
'84q_yQYKB7JjOPAIAAAD' => Set(2) { '84q_yQYKB7JjOPAIAAAD', 'demo' }
}
so my question is how do i access the values in the [object Set] ? i tried via JSON.stringify but that doesn't return anything.
When using the suggested code like this..
io.of("/").adapter.sids.forEach((set,key)=> {
let demo = [...set]
console.log('Key:', key,' Set to array: ', [...set] , set);
});
i get the following unexpected
Key: UJ3HwAIsHTgE9qvrAAAB Set to array: [] Set(2) { 'UJ3HwAIsHTgE9qvrAAAB', 'demo' } Key: Kvlt-mtnrE5NxMykAAAD Set to array: [] Set(2) { 'Kvlt-mtnrE5NxMykAAAD', 'demo' }