anon
anon

Reputation: 31

Chromecast send message returns invalid parameter error

on my sender side after i successfully create a session I have:

var onRequestSessionSuccess = function(session) {
            var namespace = 'urn:x-cast:super.awesome.example';

            var message = 'It worked!';
            console.log('Session created.');
            session.sendMessage(namespace, message, onSuccess, onFailure);
}

on the receiver side I have:

var namespace = 'urn:x-cast:super.awesome.example'; 

        var messageBus = castReceiverManager.getCastMessageBus(
            namespace,
            cast.receiver.CastMessageBus.MessageType.JSON
        );

        messageBus.onMessage = function(event) {
            var sender = event.senderId;
            var message = event.data;
            console.log('received message!');
        };

on the onFailure function on the sender app, I console.log the error message and whenever i run it i get :

Object {code: "invalid_parameter", description: "Invalid namespace", details: null}

how is 'urn:x-cast:super.awesome.example' an invalid namespace? It follows the convention of including 'urn:x-cast:' before the custom part. Also even when I replace the namespaces with something valid like: "google.cast" I get the following error message:

Object {code: "invalid_parameter", description: null, details: null}

what is the invalid parameter here?

Upvotes: 3

Views: 1316

Answers (1)

Leonid
Leonid

Reputation: 478

Be sure the following: 1) namespace is exactly the same on sender and receiver 2) messageBus is created before you run castReceiverManager.start

Upvotes: 2

Related Questions