add method
Decodes an encoded packet string into packet JSON.
Implementation
@override
add(obj) {
if (obj is String) {
final packet = <String, dynamic>{'type': num.parse(obj[8]), 'nsp': '/'};
emit('decoded', packet);
} else if (obj is Uint8List) {
final packet = m2.deserialize(obj);
final normalized = _normalize(packet);
emit('decoded', normalized);
} else {
return super.add(obj);
}
}