private static String getNamespaceId(final Session session) {
        if (!session.isOpen()) {
            LOG.warn("websocket session is closed, can not get namespaceId");
            return null;
        }
        Map<String, Object> userProperties = session.getUserProperties();
        if (MapUtils.isEmpty(userProperties)) {
            LOG.warn("websocket session userProperties is empty, can not get namespaceId");
            return null;
        }
        
        return Optional.ofNullable(userProperties.get(Constants.SHENYU_NAMESPACE_ID))
                .map(Object::toString)
                .orElse(null);
    }
On open.

@param session the session
shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/websocket/WebsocketCollector.java