realtime_client 0.0.1-dev.2 realtime_client: ^0.0.1-dev.2 copied to clipboard
Listens to changes in a PostgreSQL Database and via websockets. This is for usage with [Supabase Realtime](https://github.com/supabase/realtime) server.
Realtime Client #
Listens to changes in a PostgreSQL Database and via websockets.
This is for usage with Supabase Realtime server.
Pre-release verion! This repo is still under heavy development and the documentation is evolving. You're welcome to try it, but expect some breaking changes.
Usage #
Creating a Socket connection #
You can set up one connection to be used across the whole app.
import 'package:realtime_client/realtime_client.dart';
var socket = Socket(REALTIME_URL);
socket.connect();
Socket Hooks
socket.onOpen(() => print('Socket opened.'));
socket.onClose(() => print('Socket closed.'));
socket.onError((e) => print('Socket error: $e'));
socket.onMessage((m) => print('Socket message: $m'));
Credits #
- https://github.com/supabase/realtime-js - ported from realtime-js library
License #
This repo is liscenced under MIT.