protected void sendEventNotification(JID subscriberJID, Message notification, Collection<String> subIDs) {
        Element headers = null;
        if (subIDs != null) {
            // Notate the event notification with the ID of the affected subscriptions
            headers = notification.addChildElement("headers", "http://jabber.org/protocol/shim");
            for (String subID : subIDs) {
                Element header = headers.addElement("header");
                header.addAttribute("name", "SubID");
                header.setText(subID);
            }
        }
        
        // Verify that the subscriber JID is currently available to receive notification
        // messages. This is required because the message router will deliver packets via 
        // the bare JID if a session for the full JID is not available. The "isActiveRoute"
        // condition below will prevent inadvertent delivery of multiple copies of each
        // event notification to the user, possibly multiple times (e.g. route.all-resources). 
        // (Refer to https://igniterealtime.atlassian.net/browse/OF-14 for more info.)
        //
        // This approach is informed by the following XEP-0060 implementation guidelines:
        //   12.2 "Intended Recipients for Notifications" - only deliver to subscriber JID
        //   12.4 "Not Routing Events to Offline Storage" - no offline storage for notifications
        //
        // Note however that this may be somewhat in conflict with the following:
        //   12.3 "Presence-Based Delivery of Events" - automatically detect user's presence
        //
        if (!XMPPServer.getInstance().isLocal(subscriberJID) || subscriberJID.getResource() == null ||
            SessionManager.getInstance().getSession(subscriberJID) != null) {
            getLogger().trace("Send pub/sub notification to subscriber {}", subscriberJID);
            getService().sendNotification(this, notification, subscriberJID);
        } else {
            getLogger().trace("Suppressing pub/sub notification to subscriber {} as intended recipient is known to be offline.", subscriberJID);
        }

        if (headers != null) {
            // Remove the added child element that includes subscription IDs information
            notification.getElement().remove(headers);
        }
    }
Sends an event notification to the specified subscriber. The event notification may
include information about the affected subscriptions.

@param subscriberJID the subscriber JID that will get the notification.
@param notification the message to send to the subscriber.
@param subIDs the list of affected subscription IDs or null when node does not
       allow multiple subscriptions.
xmppserver/src/main/java/org/jivesoftware/openfire/pubsub/Node.java