connect static method
Future<RobustIrc>
connect(
- String hostname, {
- bool lookupHostname = true,
- String userAgent = 'robustirc.dart 0.0.1',
- List<
RobustIrcServer> ? servers,
Implementation
static Future<RobustIrc> connect(
String hostname, {
bool lookupHostname = true,
String userAgent = 'robustirc.dart 0.0.1',
List<RobustIrcServer>? servers,
}) async {
servers ??= lookupHostname
? await _lookupServers(hostname)
: [RobustIrcServer(hostname, 60667)];
if (servers == null) throw 'cant get server list';
final json =
jsonDecode(await _postToServer(servers, '/session', '', userAgent));
return RobustIrc(
hostname,
servers,
userAgent,
json['Sessionid'],
json['Sessionauth'],
json['Prefix'],
);
}