i have this JS function call:
this.customMessageBus = castReceiverManager.getCastMessageBus('urn:x-cast:mycastapp', cast.receiver.CastMessageBus.MessageType.JSON);
var errorMessage = {
action: 'ERROR_MESSAGE',
errorCode: 'code',
errorMessage: 'sometext'
};
this.customMessageBus.broadcast(errorMessage);
in trying to write the corrispective in DART:
this.customMessageBus = castReceiverManager.callMethod("getCastMessageBus",
[
'urn:x-cast:mycastapp',
'cast.receiver.CastMessageBus.MessageType.JSON'
]);
this.customMessageBus.callMethod("broadcast", ['{
action: 'ERROR_MESSAGE',
errorCode: 'code',
errorMessage: 'sometext'
}']);
But i take this exception:
EXCEPTION: Error: Unexpected message type for JSON serialization in [null]
The MessageBus component is documented at https://developers.google.com/cast/docs/reference/receiver/cast.receiver.CastMessageBus#constructor_1