From 6f214f74689fc9f894c325737859fd30c9f4a0ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Sat, 24 Jan 2026 13:22:35 +0400 Subject: [PATCH] =?UTF-8?q?feat:=20ajoute=20la=20possibilit=C3=A9=20de=20d?= =?UTF-8?q?=C3=A9sactiver=20les=20websockets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.sample | 3 +++ components/session/sign.js | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/.env.sample b/.env.sample index b70cd55..d9168e6 100644 --- a/.env.sample +++ b/.env.sample @@ -16,3 +16,6 @@ NEXT_PUBLIC_DIRECTUS_API_WS_URL=$DIRECTUS_API_WS_URL # COMMENTS COMMENTS_PER_PAGE=5 + +# WEBSOCKET +NEXT_PUBLIC_DISABLE_WEBSOCKET=false diff --git a/components/session/sign.js b/components/session/sign.js index 71d2b40..0dc4ba0 100644 --- a/components/session/sign.js +++ b/components/session/sign.js @@ -16,6 +16,7 @@ import {createDirectus, realtime, staticToken} from '@directus/sdk' import ConfirmationAlert from './confirmation-alert.js' const apiUrl = process.env.DIRECTUS_API_URL || process.env.NEXT_PUBLIC_DIRECTUS_API_URL +const disableWebSocket = process.env.NEXT_PUBLIC_DISABLE_WEBSOCKET === 'true' const LightTooltip = styled(({className, ...props}) => ( @@ -40,6 +41,10 @@ export default function Sign({session, navButton}) { useEffect(() => { let cleanup = () => {} + if (disableWebSocket) { + return () => cleanup() + } + if (session?.user?.accessToken) { (async () => { try {