attach method
The handshake that makes connection ≠ attachment: nothing is written to a peer that has not asked, so a probe that connects and closes is free.
Implementation
void attach(InspectorPeer peer, int requestId) {
var events = _ring.values.expand((q) => q).toList()
..sort((a, b) => a.id.compareTo(b.id));
send(peer, {
frameChannel: metaChannel,
frameType: typeResponse,
frameRequestId: requestId,
framePayload: {
...identity(),
'channels': channels,
'events': events.length,
},
});
for (var event in events) {
send(peer, event.toFrame());
}
send(peer, {
frameChannel: metaChannel,
frameType: typeEvent,
framePayload: {'type': metaReplayDone},
});
_attached.add(peer);
}