ObbyAsyncClient class
Drives an ObbyClient off an already-open transport: bytes in through incoming, bytes out
through send. A dart:io Socket supplies both: pass the socket itself as incoming and
socket.add as send. A WebSocket, or any other Stream<List<int>> with a matching sink,
fits the same way.
Owns the same poll/drain loop the manual example in obby_client.dart does: it flushes
pollTransmit after every input, ticks the clock on every input, and schedules the next tick
from pollTimeout() with a Timer, so the loop sleeps until the engine has something to do.
Call close when finished, same as with a plain ObbyClient: it cancels the timer, stops listening, closes events, and frees the engine.
final socket = await Socket.connect('irc.libera.chat', 6667);
final driver = ObbyAsyncClient(socket, socket.add, nick: 'mynick');
await for (final event in driver.events) {
if (event is ObbyEventRegistered) driver.client.join('#obby');
}
Constructors
-
ObbyAsyncClient(Stream<
List< incoming, void send(List<int> >int> data), {required String nick, String? username, String? realname, String? password, SaslCredentialsInput? sasl, int? retention, List<String> ? altNicks, String? libraryPath}) -
Build the engine and start driving it over
incoming/send. Onlynickis required; every other field has the same default ObbyClient.new does. -
ObbyAsyncClient.withClient(ObbyClient client, Stream<
List< incoming, void _send(List<int> >int> data)) - Drive an ObbyClient a host already built, over an already-open transport.
Properties
- client → ObbyClient
-
The underlying engine, for commands the typed helpers on it don't cover.
final
-
events
→ Stream<
ObbyEvent> -
Every event the engine produces, decoded as it arrives. Ends once the transport closes.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → Future< void> - Close cleanly: cancel the timer, stop listening, close events, and free the engine.
-
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