@Override
    public void destroy()
    {
        // terminate any active websocket sessions
        SessionManager sm = XMPPServer.getInstance().getSessionManager();
        for (ClientSession session : sm.getSessions()) {
            if (session instanceof LocalSession) {
                Object ws = ((LocalSession) session).getSessionData("ws");
                if (ws != null && (Boolean) ws) {
                    Log.debug( "Closing session as websocket servlet is being destroyed: {}", session );
                    session.close();
                }
            }
        }

        super.destroy();
    }
This Servlet enables XMPP over WebSocket (RFC 7395) for Openfire.

The Jetty WebSocketServlet serves as a base class and enables easy integration into the
BOSH (http-bind) web context. Each WebSocket request received at the "/ws/" URI will be
forwarded to this plugin/servlet, which will in turn create a new {@link WebSocketClientConnectionHandler}
for each new connection.
xmppserver/src/main/java/org/jivesoftware/openfire/websocket/OpenfireWebSocketServlet.java