Back to Directus

Realtime

content/configuration/realtime.md

latest5.2 KB
Original Source

:partial{content="config-env-vars"}

Directus Realtime provides WebSockets and GraphQL Subscriptions.

VariableDescriptionDefault Value
WEBSOCKETS_ENABLEDWhether or not to enable all WebSocket functionality.false
WEBSOCKETS_HEARTBEAT_ENABLEDWhether or not to enable the heartbeat ping signal.true
WEBSOCKETS_HEARTBEAT_PERIODThe period in seconds at which to send the ping. This period doubles as the timeout used for closing an unresponsive connection.30

It's recommended to keep the WEBSOCKETS_HEARTBEAT_PERIOD between 30 and 120 seconds, otherwise the connections could be considered idle by other parties and therefore terminated.

WebSockets

VariableDescriptionDefault Value
WEBSOCKETS_REST_ENABLEDWhether or not to enable the WebSocket message handlers.true
WEBSOCKETS_REST_PATHThe URL path at which the WebSocket endpoint will be available./websocket
WEBSOCKETS_REST_CONN_LIMITHow many simultaneous connections are allowed.Infinity
WEBSOCKETS_REST_AUTHThe method of authentication to require for this connection. One of public, handshake or strict.handshake
WEBSOCKETS_REST_AUTH_TIMEOUTThe amount of time in seconds to wait before closing an unauthenticated connection.30

::callout{icon="material-symbols:menu-book-outline" color="primary" to="/guides/realtime/authentication"} Read more about different authentication methods with Directus Realtime. ::

GraphQL

VariableDescriptionDefault Value
WEBSOCKETS_GRAPHQL_ENABLEDWhether or not to enable GraphQL Subscriptions.true
WEBSOCKETS_GRAPHQL_PATHThe URL path at which the GraphQL Subscriptions endpoint will be available./graphql
WEBSOCKETS_GRAPHQL_CONN_LIMITHow many simultaneous connections are allowed.Infinity
WEBSOCKETS_GRAPHQL_AUTHThe method of authentication to require for this connection. One of public, handshake or strict.handshake
WEBSOCKETS_GRAPHQL_AUTH_TIMEOUTThe amount of time in seconds to wait before closing an unauthenticated connection.30

::callout{icon="material-symbols:menu-book-outline" color="primary" to="/guides/realtime/authentication"} Read more about different authentication methods with Directus Realtime. ::

Collaborative Editing

::callout{icon="material-symbols:info-outline"} Multi-instance collaboration requires a shared Redis instance for coordination. ::

VariableDescriptionDefault Value
WEBSOCKETS_COLLAB_ENABLEDToggle collaborative editing functionality specifically (when WebSockets are enabled).true
WEBSOCKETS_COLLAB_INSTANCE_TIMEOUTDuration in milliseconds before a silent node is considered dead.10000
WEBSOCKETS_COLLAB_CLUSTER_CLEANUP_CRONCron expression for how often to garbage-collect empty rooms.*/1 * * * *
WEBSOCKETS_COLLAB_LOCAL_CLEANUP_INTERVALDuration in milliseconds between local cleanup sweeps.60000
WEBSOCKETS_COLLAB_PERMISSIONS_CACHE_CAPACITYLRU cache size for permission checks.2000
WEBSOCKETS_COLLAB_STORE_NAMESPACEThe namespace used for Redis storage.collab

Logging

Read more about logging with Directus Realtime in the logging configuration.