connect method
Connect to Slack.
Implementation
Future connect() async {
final dumpExcludes = ['reconnect_url', 'pong'];
final sess = await RtmSession._connect(_token);
this.sess = sess;
var timer = _pingTimer(sess);
await for (final msg in sess._ws) {
timer.cancel();
timer = _pingTimer(sess);
final str = msg as String;
final json = jsonDecode(_clean(str)) as Map<String, dynamic>;
final type = json['type'] as String;
final hand = _handlers[type];
if (hand != null) {
hand(json, sess);
} else if (_dumpUnhandle && !dumpExcludes.contains(type)) {
print(msg);
}
}
}