ResClient class
Properties
channel
↔ WebSocketChannel
getter/setter pair
currentId
↔ int
The ID of the message and the response are the same, that's how we can
figure out which response corresponds to which sent message.
getter/setter pair
hashCode
→ int
The hash code for this object.
no setter inherited
onReconnect
↔ Future <void > Function() ?
Called after a successful reconnection so the consumer can
re-authenticate and re-subscribe to collections.
getter/setter pair
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
stream
↔ Stream
Stable broadcast stream of all incoming WebSocket messages.
This reference remains valid across reconnections.
getter/setter pair
Methods
authenticate (String rid , Map <String , dynamic > params )
→ Future <Map <String , dynamic > >
Send the credentials so it can be stored on this connection.
connect (String url , {Duration pingInterval = const Duration(seconds: 30) })
→ void
Connect to the given Resgate server.
destroy ()
→ Future <void >
Close the websocket connection.
getCollection <T extends ResModel > (String rid , T modelFactory () )
→ Future <ResCollection <T > >
Subscribe to a collection.
The collection will automatically listen for changes to the collection (add and remove).
Additionally, the collection will listen for changes to each model in the collection.
listen (void handler (Map <String , dynamic > ), {bool filter (Map <String , dynamic > )? })
→ StreamSubscription
Listen in on the stream, executing the handler for each message.
Optionally filtering the messages that the handler is executed on.
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
receive (int id )
→ Future <Map <String , dynamic > >
Wait for a response that has the given id, which matches with the sent message.
send (String type , String ? rid , Map <String , dynamic > ? params )
→ Future <int >
Publish a Resgate message on the websocket channel.
toString ()
→ String
A string representation of this object.
inherited