decodeControl function

Map<String, Object?>? decodeControl(
  1. List<int> payload
)

Decode the JSON object of a control frame, or return null if it isn't one.

Implementation

Map<String, Object?>? decodeControl(List<int> payload) {
  try {
    final message = jsonDecode(utf8.decode(payload));

    return message is Map<String, Object?> ? message : null;
  } on FormatException {
    return null;
  }
}