thibauts / node-castv2

An implementation of the Chromecast CASTV2 protocol
MIT License
765 stars 99 forks source link

How to respond to clients? #57

Closed thorleifjacobsen closed 5 years ago

thorleifjacobsen commented 5 years ago

Your document says:

First, the sender sends a challenge message to the platform receiver receiver-0 which responds by either a response message containing a signature, certificate and a variable number of certificate authority certificates that the sent certificate is verified against or an error message. These 3 payloads are protocol buffers encoded and described in cast_channel.proto as follows :

This challange is received by my node app, but how does it expect the data to be sent back? And what? Could you provide an example of communication between a "cast" and a client in code? I want to make a fake control channel which behaves just like a real chromecast (just ping / pong, what app is running & start app) .

Thanks in advance

thorleifjacobsen commented 5 years ago

Think I solved my own issue:

` var message = { protocol_version: 0, // CASTV2_1_0 source_id: message.source_id, destination_id: message.destination_id, namespace: message.namespace };

  message.payload_type = 0 // STRING;
  message.payload_utf8 = '{ "type": "PING" }';

  var buf = CastMessage.serialize(message);
  this.send(buf)

`

feross commented 5 years ago

Excellent, glad you figured it out. Thanks for sharing your solution.