isPayloadValid static method
dynamic
isPayloadValid(
- dynamic type,
- dynamic payload
Implementation
static isPayloadValid(type, payload) {
switch (type) {
case CONNECT:
return payload == null || payload is Map || payload is List;
case DISCONNECT:
return payload == null;
case CONNECT_ERROR:
return payload is String ||
payload == null ||
payload is Map ||
payload is List;
case EVENT:
case BINARY_EVENT:
return payload is List && payload[0] is String;
case ACK:
case BINARY_ACK:
return payload is List;
}
}