Send message to all resources?

Currently, if a user is logged in twice, using two different resources, with an identical priority, wildfire will only send the message to the most recent user. For various reasons, I’'d like a message that comes in to any one resource of a user to be sent to all resources for that user as well.

Any ideas on where I should start looking code wise for a plugin that accomplishes this?

Hey Mark,

Check out SessionManager#userBroadcast(String username, Packet packet). There is also a jira issue about improving the logic being used when a message was sent to a bare JID so that Wildfire can be smarter and use different algorithms to decide the user/s that will get the message.


– Gato

Thanks, it seems that this, with a PacketInterceptor does the trick. I’‘ve got some additional testing to do to make sure it doesn’‘t interfere with muc, but it’'s working pretty well.

Basically I look for a packet id with a particular prefix. If it doesn’‘t have the prefix, then I append a prefix onto the paket id, broadcast it out, and reject the original packet (so one instance doesn’‘t get two messages). Then when that broadcasted message comes through the interceptor again, it’'s prefix matches, so I ignore it, and it gets delivered.

I hit on this after not checking the prefix, and broadcasting the packet. Then when each user received the broadcasted packet, it was broadcast again, and again, and again, the number of broadcasts growing exponentially. Now that kills performance.