How ChromeCast Communicate with reciever app and sender App? - chromecast

As we know we send and receive message in json form from send app to receiver app. what is the proper channel for sending and receiving message and what role ChromeCast play in whole picture?

Senders and receivers are establishing a socket connection and communicate via IPC. While it's true that this communication is in JSON format, you will likely neither generate that data yourself nor care about the 'how' or 'channels' of it - in fact, you are not even allowed to following the terms of service by Google.
Instead, you have the SDK handle that for you one both the sender and receiver site.
Communication is done in the form of defined Messages that implement a schema and contain objects - most notably for media playback that is MediaInformation.
Most of those objects that are passed between sender and receiver have a customData property that you can use to add self-defined payload in JSON format.
If you want to implement your own features you can implement custom messages.

Related

How to subscribe to a notification stream for packet_In processing?

I am writing an external application that uses REST to communicate with open-daylight. I need to get a notification whenever a new communication between two nodes is needed.
I've checked how to subscribe for event notification in the following link. But I am not sure if this is possible for a packet_in event.
Is it possible to get a notification of the new connection packet_in, with/without some information about the packet?
What would be the path used to create-data-change-event-subscription? also, how can I check all available events and paths that I can make use of?
I believe the "packet_in" event is a yang notification however the REST notification subscription mechanism is for data change notifications. Unfortunately there is no mechanism currently (that I know of) to subscribe to yang notifications over rest.

WM_COPYDATA, PostThreadMessage, and Error 1159

I am trying to send data from one app to another using WM_COPYDATA. Both apps are console and have no window. I can send user messages just fine. When I try to send WM_COPYDATA, and setup the data structure or not, I get error 1159, which basically says I have to send using a synchronous message call... yet there is no SendThreadMessage.
It seems this is a oversight in the api or docs? There seems to be no way to use WM_COPYDATA using only threads without windows?
WM_COPYDATA can only be sent and cannot be posted. Because the payload is marshaled between processes, temporary data structures are created to support that marshaling. They need to be destroyed when the message processing is complete. That implies that the message must be delivered synchronously.
All of this means that you cannot use PostThreadMessage. Instead you will need to create a window to act as the recipient of such messages. Note that this window can be a message-only window and does not need to be visible.

Disconnect sender unauthorized

I am creating an app for android to support google cast for video with interaction using CastCompanionLibrary library.
On the video VideoCastManager use and for the part of the exchange of messages (data) DataManagerCast use.
I want to implement a control who can connect to a particular session. My idea is that the first sender to connect on chromecast be the "owner of the session" and other senders need to ask permission to him to connect. I created a namespace for communication between the receiver and the sender session owner for the connection process occurs.
If the sender is not authorized then it should disconnect.
I took a look at receiver reference searching for a method to the receiver disconnect a particular sende, but it still fails. Does anyone know if it is possible to implement this my idea?
First, why are you using DataCastManager? VideoCastManager can add a data channel and that is all you'd need to communicate so only use the VideoCastManager.
As far as memory serves, receiver cannot disconnect individual senders, so an alternative to your approach would be:
Each sender, after connecting to the receiver, will send a message to receiver to register itself.
Receiver looks at the number of connected devices, if that is the first one, it considers that the owner an sends back a message to the sender letting it know that it is the owner. If it is not the first one, it sends back a message to that sender, informing it that it needs to get authorization from the owner (so the new sender knows that it should wait for an authorization). At the same time, it sends a message to the owner asking for permission to allow the second one in.
The owner will send back a message to the receiver to allow or prohibit the new sender to connect. Receiver then sends a message to the new sender to let it know if its request was granted or not.
If permission was granted, then your code in your sender would allow the user to move forward in the app. If it is not granted, then the logic in your sender app can either stop the user from going forward, or can disconnect the sender, or can just limit the stuff that teh user can do.

Quickblox - Listener Firing Multiple times

I'm using Quickblox in Ionic (Angular), with Parse for my database. Whenever I send friend requests, it only sends one, and the receiver only receives one, but the listener goes off some random number of times (3-10), Consequently, if I send a chat, it will send the same number as there are friend requests. However, if I hard-code in the user who sends and receives chats, it the chat receiver still does the same thing.
I'm using Parse to manage Quickblox accounts. So I'm fairly theres some issue with session management and connections to Quickblox.

How to pass custom data/parameters to Chromecast receiver via URL?

Is it possible to have a Chromecast sender application to pass custom data to the receiver in the URL? The goal is to pass user-specific data to the receiver so it can generate the appropriate contents each time it's called.
An example of this would be a simple to-do list. When the user casts to their device, that user's data should be passed via URL to the receiver so that their task list can be loaded in the custom receiver.
I haven't seen any tutorials or much information on this in the Cast documentation.
If you mean passing parameters as part of the receiver url that loads the receiver, the answer is no; there is no such thing. You can either use the customData that can be passed to the receiver in a number of APIs, or you can create a custom data channel if the former is not adequate for your needs.
The Cast receiver URL is specified as a static URL when you're registering/publishing the app on the Google Cast SDK Developer Console so it is not possible to add custom parameters.
However you can use the Cast Messages system to send data between a Cast sender and Cast receiver. It's similar to the messaging system in modern browsers.

Resources