handleMessage method

void handleMessage(
  1. String raw
)

Handle a raw incoming message string from the transport layer.

Implementation

void handleMessage(String raw) {
  try {
    final msg = _serializer.parse(raw);
    switch (msg.type) {
      case MessageType.request:
        _handleRequest(msg.request!);
      case MessageType.response:
        _handleResponse(msg.response!);
      case MessageType.notification:
        _handleNotification(msg.notification!);
    }
  } on BridgeError catch (e) {
    _errors.add(e);
  } catch (e) {
    _errors.add(BridgeError.internalError(e.toString()));
  }
}