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
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
stream
↔ Stream
We need a broadcast stream here as we want a temporary listener per
message sent. As we can send message in an async manner we might have more
than one listener at a time.
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 )
→ 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
version ()
→ Future <Map <String , dynamic > >
Requests the RES protocol version of the Resgate server.