WebSocketsService<Id, Data> class

A Service that asynchronously interacts with the server.

Inheritance
Implementers

Constructors

WebSocketsService(WebSocketChannel? socket, BaseWebSocketClient app, String path, {AngelDeserializer<Data>? deserializer})

Properties

app BaseWebSocketClient
The BaseWebSocketClient that spawned this service.
final
deserializer AngelDeserializer<Data>?
Used to deserialize JSON into typed data.
final
hashCode int
The hash code for this object.
no setterinherited
onAllEvents Stream<WebSocketEvent>
Fired on all events.
no setter
onCreated Stream<Data?>
Fired on created events.
no setteroverride
onIndexed Stream<List<Data?>>
Fired on index events.
no setteroverride
onModified Stream<Data?>
Fired on modified events.
no setteroverride
onRead Stream<Data?>
Fired on read events.
no setteroverride
onRemoved Stream<Data?>
Fired on removed events.
no setteroverride
onUpdated Stream<Data?>
Fired on updated events.
no setteroverride
path String
The service path to listen to.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
socket → WebSocketChannel?
The WebSocketChannel to listen to, and send data across.
final

Methods

close() Future
override
create(Data? data, [Map<String, dynamic>? params]) Future<Data?>
Creates a resource.
override
deserialize(dynamic x) → Data?
Deserializes data from a WebSocketEvent.
index([Map<String, dynamic>? params]) Future<List<Data>?>
Retrieves all resources.
override
listen() → void
Starts listening for events.
map<U>(U encoder(Data?), Data? decoder(U)) Service<Id, U>
Creates a Service that wraps over this one, and maps input and output using two converter functions.
inherited
modify(Id id, Data? data, [Map<String, dynamic>? params]) Future<Data?>
Modifies a resource.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(Id id, [Map<String, dynamic>? params]) Future<Data?>
Retrieves the desired resource.
override
remove(Id id, [Map<String, dynamic>? params]) Future<Data?>
Removes the given resource.
override
send(WebSocketAction action) → void
Sends the given action on the socket.
serialize(WebSocketAction action) → dynamic
Serializes an action to be sent over a WebSocket.
toString() String
A string representation of this object.
inherited
transformEvent(WebSocketEvent event) WebSocketEvent<Data>
Deserializes the contents of an event.
update(Id id, Data? data, [Map<String, dynamic>? params]) Future<Data?>
Overwrites a resource.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited