Description
This module adds realtime state sync via WebSockets.
The main feature is the useRealtimeState composable which can be used like a normal useState with automatic syncing across all clients.
Here is a simple example of how it works:
<script setup>
// Works just like useState but synced across all clients
const poll = useRealtimeState('poll', {
question: 'Tabs or spaces?',
tabs: 0,
spaces: 0,
})
// Every connected client sees this instantly
poll.value.tabs++
</script>
It's built on Socket.IO with channel-based subscriptions under the hood, so users don't have to deal with any of the wiring or complexities of websockets.
Repository
https://github.com/daanvangeloven/nuxt-realtime
npm
https://www.npmjs.com/package/nuxt-realtime
Nuxt Compatibility
Nuxt 3
Description
This module adds realtime state sync via WebSockets.
The main feature is the
useRealtimeStatecomposable which can be used like a normaluseStatewith automatic syncing across all clients.Here is a simple example of how it works:
It's built on Socket.IO with channel-based subscriptions under the hood, so users don't have to deal with any of the wiring or complexities of websockets.
Repository
https://github.com/daanvangeloven/nuxt-realtime
npm
https://www.npmjs.com/package/nuxt-realtime
Nuxt Compatibility
Nuxt 3