UhstSocketEventType enum
Defines message types for event streams inside client sockets
Usage example:
/// Event stream
final Stream<Map<UhstSocketEventType, dynamic>> eventStream;
/// Event stream controller
final StreamController<Map<UhstSocketEventType, dynamic>>
eventStreamController;
/// Stream and controller initialization
eventStreamController = StreamController<Map<UhstSocketEventType,
dynamic>>.broadcast();
eventStream = eventStreamController.stream;
/// Send event and message to stream
void emit({required UhstSocketEventType message, dynamic body}) {
eventStreamController.add({message: body});
}
/// Listen event and message
eventStream.listen((event) {
if (event.containsKey(UhstSocketEventType.connection)) {
var message = event.values.first;
print(message);
}
});
Constructors
- UhstSocketEventType()
-
const
Values
- error → const UhstSocketEventType
- message → const UhstSocketEventType
- open → const UhstSocketEventType
- close → const UhstSocketEventType
- diagnostic → const UhstSocketEventType
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
UhstSocketEventType> - A constant List of the values in this enum, in order of their declaration.