onConnection method
StreamSubscription<Map<HostEventType, dynamic> >
onConnection({
- required HostConnectionHandler handler,
inherited
Implementation
@override
StreamSubscription<Map<HostEventType, dynamic>> onConnection({
required HostConnectionHandler handler,
}) {
final subsription = h.eventStream.listen((event) {
if (event.containsKey(HostEventType.connection)) {
final maybeSocket = event.values.first;
if (maybeSocket is UhstSocket) {
handler(uhstSocket: maybeSocket);
}
}
});
h.connectionListenerHandlers
.update(handler, (value) => subsription, ifAbsent: () => subsription);
return subsription;
}