supabase_realtime 3.0.0-dev.16
supabase_realtime: ^3.0.0-dev.16 copied to clipboard
Listens to changes in a PostgreSQL Database and via websockets. This is for usage with Supabase Realtime server.
supabase_realtime
Dart client library for Supabase Realtime, to listen to changes in a PostgreSQL database over websockets.
Note
This package was published as
realtime_clientup to and including v2. That package is discontinued in favour ofsupabase_realtime.
Supabase Service Compatibility #
supabase_realtime only guarantees compatibility with the latest Supabase
Realtime release. Older Supabase
Realtime releases are supported on a best-effort basis, but compatibility is not
guaranteed.
If you self-host Supabase Realtime, we recommend upgrading to the latest release when upgrading this SDK.
Docs #
The docs can be found on the official Supabase website.
Channel security #
Channels are public unless they are created with RealtimeChannelConfig(private: true). Any
client with the project's API key can join a public channel and send or receive its broadcast and
presence messages. A client can only join a private channel when the RLS policies on
realtime.messages allow it, see
Realtime Authorization.
channel() returns the channel that is already registered for a topic, and throws a StateError
if that channel was created with other options. Remove the channel with removeChannel() before
creating it again with new options, for example when another user signs in.
The API key is sent as the apikey query parameter of the WebSocket URL, so servers and proxies
can log it. Only use the publishable key in a client. The access token of the signed-in user is
sent in the messages on the socket, not in the URL.
Testing #
The unit tests run without any external services:
dart test -x integration
The integration tests in test/realtime_integration_test.dart run against a
real Supabase Realtime server. Start the local Supabase stack with the CLI first
(from the repository root), then run the full suite:
supabase start
dart test
supabase stop
License #
This repo is licensed under MIT.
Credits #
- https://github.com/supabase/realtime-js - ported from realtime-js library