realtime_client 패키지는 웹소켓을 사용하여 PostgreSQL 데이터베이스에서 실시간 업데이트를 수신할 수 있도록 하며, Supabase Realtime 서버와의 통합을 위해 특별히 설계되었습니다. 앱은 삽입, 업데이트, 삭제와 같은 데이터베이스 변경 사항을 실시간으로 감지할 수 있으며, 수동 풀링 없이 클라이언트 간에 데이터가 동기화됩니다. 협업 앱, 채팅 시스템 또는 즉각적인 데이터 새로 고침이 필요한 대시보드에 적합합니다. 이 패키지는 모바일, 웹, 데스크톱을 포함한 모든 주요 플랫폼을 지원하므로 크로스플랫폼 실시간 경험에 적합합니다.
The helpers the test suites of these packages run on are published in
package:supabase_test,
so your tests can build on the same primitives: mock HTTP clients, JWT builders,
auth session fixtures and realtime frames. Add the package as a dev dependency:
dev_dependencies:supabase_test:^0.1.0
Then stub the endpoints the code under test talks to and run it against a
real SupabaseClient, with no running stack required:
final httpClient = MockSupabaseHttpClient()
..stubTable('todos', rows: [
{'id': 1, 'task': 'Ship it', 'status': false},
]);
final supabase = testSupabaseClient(httpClient: httpClient);
addTearDown(supabase.dispose);
final todos = await supabase.from('todos').select();
expect(todos, hasLength(1));
See the supabase_test README for the
full guide: stubbing database, rpc, edge function and auth endpoints,
asserting on recorded requests, running tests as a signed-in user, and wiring
Supabase.initialize in Flutter widget tests.
Testing this repo
The tests for the packages postgrest, supabase_auth, supabase_realtime and supabase_storage run against a
local Supabase stack. To run these tests locally you need docker and the
Supabase CLI installed.
The single configuration for the stack lives in the supabase directory at the repository root.
Start it with:
supabase start
Run the Dart tests within the package directory in packages/<package> with the following command.
The -j 1 flag runs the tests not concurrently, which works better since the tests run against the
same services.
dart test -j 1
To stop the stack run the following command from the repository root: