buglabs/bugswarm-api — Issue #7: i can't join more than one Swarm using JS API
Author: santiago
Created: 2011-10-26 18:44:40+00:00
State: open

Here https://github.com/buglabs/bugswarm-webui/blob/0.2.1/public/javascripts/bugswarm.js#L76;
where I'm passing an Array with more than one (1) Swarm to **SWARM.connect**, it results in this error:

The Array of Swarms ...

["dbb78ebb437970291aef968803cc67ace9d7a742", "ff0121226c42869f08948098415be99382818d54",
"dc92b3405e4ad5dee9a35864583b2e768a85a3f7", "ebc7b30beac7e242a97b652eb88e27a8a11af3c2",
"cde3c7ca4472e5a641487e31fd61a412a525b998", "4fee0b949c7e591b708a841ffceb72e5c33138af"]

The error ...

bugswarm.js:62error! -> [{"code":"028","description":"Swarm
dbb78ebb437970291aef968803cc67ace9d7a742,ff0121226c42869f08948098415be99382818d54,dc92b3405e4ad5dee9a35
864583b2e768a85a3f7,ebc7b30beac7e242a97b652eb88e27a8a11af3c2,cde3c7ca4472e5a641487e31fd61a412a525b998,4f
ee0b949c7e591b708a841ffceb72e5c33138af does not exists or your resource is not allowed to participate in it."}]

Due to this failure, I tried using SWARM.connect passing only the **first** Swarm from the Array ...

https://github.com/buglabs/bugswarm-webui/blob/0.2.1/public/javascripts/bugswarm.js#L77

... and then, onConnect, I tried passing the same Array to SWARM.join

https://github.com/buglabs/bugswarm-webui/blob/0.2.1/public/javascripts/bugswarm.js#L45

... but it doesn't to appear be joining the passed Swarms because they don't get presence from resources connected to them.

Finally I tried joining Swarms one by one ...

https://github.com/buglabs/bugswarm-webui/blob/0.2.1/public/javascripts/bugswarm.js#L51

... which apparently joins the passed Swarm because I do get presence from the resources connected to it.

```javascript
function onConnect() {
$(".loading").fadeOut();

// SWARM.join(swarms);
/*
Passing an array to SWARM.join doesn't appear to be joining the passed
Swarms because they don't get presence from resources connected to them
*/

swarms.forEach(function(s) {
SWARM.join(s)
});
/*
Passing only one Swarm to SWARM.join does appear to be joining the passed Swarm
because I do get presence from the resources connected to it
*/
}
```

However, **and this is important**, I'm only seeing messages sent to the **first** Swarm of the Array, that is, the one used in SWARM.connect