class ChatroomChannel implements WebSocketChannel {

    /**
     * Session set.
     */
    public static final Set<WebSocketSession> SESSIONS = Collections.newSetFromMap(new ConcurrentHashMap());

    /**
     * Called when the socket connection with the browser is established.
     *
     * @param session session
     */
    @Override
    public void onConnect(final WebSocketSession session) {
        SESSIONS.add(session);

        synchronized (SESSIONS) {
            final Iterator<WebSocketSession> i = SESSIONS.iterator();
            while (i.hasNext()) {
                final WebSocketSession s = i.next();
                final String msgStr = new JSONObject().put(Common.ONLINE_CHAT_CNT, SESSIONS.size()).put(Common.TYPE, "online").toString();
                s.sendText(msgStr);
            }
        }
    }

    /**
     * Called when the connection closed.
     *
     * @param session session
     */
    @Override
    public void onClose(final WebSocketSession session) {
        removeSession(session);
    }

    /**
     * Called when a message received from the browser.
     *
     * @param message message
     */
    @Override
    public void onMessage(final Message message) {
    }

    /**
     * Called when a error received.
     *
     * @param error error
     */
    @Override
    public void onError(final Error error) {
        removeSession(error.session);
    }

    /**
     * Notifies the specified chat message to browsers.
     *
     * @param message the specified message, for example,
     *                {
     *                "userName": "",
     *                "content": ""
     *                }
     */
    public static void notifyChat(final JSONObject message) {<FILL_FUNCTION_BODY>}

    /**
     * Removes the specified session.
     *
     * @param session the specified session
     */
    private void removeSession(final WebSocketSession session) {
        SESSIONS.remove(session);

        synchronized (SESSIONS) {
            final Iterator<WebSocketSession> i = SESSIONS.iterator();
            while (i.hasNext()) {
                final WebSocketSession s = i.next();
                final String msgStr = new JSONObject().put(Common.ONLINE_CHAT_CNT, SESSIONS.size()).put(Common.TYPE, "online").toString();
                s.sendText(msgStr);
            }
        }
    }
}

        message.put(Common.TYPE, "msg");
        final String msgStr = message.toString();

        synchronized (SESSIONS) {
            final Iterator<WebSocketSession> i = SESSIONS.iterator();
            while (i.hasNext()) {
                final WebSocketSession session = i.next();
                session.sendText(msgStr);
            }
        }
    
<no_super_class>