balderdashy/sails — pull request #1887 by psobot (2014-06-24 18:34:10+00:00)
Title: Changed sails.sockets.subscribers to return sockets instead of IDs.

While building a Sails app, we ran into an odd issue where certain websockets weren't being subscribed to the correct rooms when new objects were created, which resulted in clients failing to receive a message when `publishDestroy` was called.

We eventually traced this issue back to what looks like a type mismatch: `subscribers` and `watchers` functions are both documented to return socket objects, but they returned IDs. As well, [the `introduce` function](#L1430) calls `subscribe` with the results of the `watchers()` function. `subscribe` expects a `request` or `socket` object as its first parameter, but was receiving a string. (This was preventing legacy clients from receiving events on models that they had been `introduce`d to.)

I managed to trace the original change back to [a commit in January](https://github.com/balderdashy/sails/commit/c019f26c1be2dfc85faf84484676bce657d6a2d8), but it doesn't appear that `sails.sockets.subscribers` is used anywhere else anymore.