Can you explain how to make connection between Hbbtv React App in TV and mobile App in React Native?
I implement SSDP Client in React Native Mobile App to look for SSDP Server (That should be implmented on TV). Then receiving IP Address of that Server (Like in DIAL Architecture). Server also creating WebSocket Server. This server should start Hbbtv App that is written in React.js.
Now I can send messages from Mobile App to Hbbtv React App through this server, but I have no idea how to implement this kind of SSDP+WebSocket server on my TV.
Question posted in React native
The official React Native documentation can be found here.
The official React Native documentation can be found here.
2
Answers
This project https://github.com/fraunhoferfokus/cordova-plugin-hbbtv provides a good example and may answer your question. It is a cordova plugin for Android, but gives you an overview how to implement the Client for framework like React Native. The Hello World Mobile application in https://github.com/fraunhoferfokus/cordova-plugin-hbbtv-helloapp/ provides an example to use the plugin to discover and launch on TV.
The HbbTV App is developed using Web Technologies like in your case React.js and uses WebSocket to establish a connection to the local WebSocket Server running on the HbbTV Terminal. This folder https://github.com/fraunhoferfokus/cordova-plugin-hbbtv-helloapp/tree/master/www provides an example of a simple HbbTV App using CS Features. You can take it as a reference for your react.js. The main file you need to follow is https://github.com/fraunhoferfokus/cordova-plugin-hbbtv-helloapp/blob/master/www/js/cs-app.js. I hope this help.
For successful communication, the Companion Screen application should be on the same home network as the HbbTV terminal (TV Set).
The terminal (TV Set) implements the server providing endpoints that provide the server-side of the Websocket protocol for clients (HbbTV® application on the terminal and Companion Screen application).
The server shall be able to accept connections once an HbbTV® application on the terminal (TV Set) has called the getApp2AppLocalBaseURL() method of the HbbTVCSManager embedded object and until the application exits. Please see:
https://developer.hbbtv.org/references/apis/defined-javascript-apis/companion-screen-discovery-apis/
The terminal (TV Set) handles connection requests from clients (HbbTV® application and Companion Screen application) in the manner defined in clause 14.5.3 of the ETSI TS 102 796 standard and applies pairing rules defined in clause 14.5.4 of the ETSI TS 102 796 standard to determine whether to pair connections from two clients. It then acts as a relay, as defined in clause 14.5.5 of the ETSI TS 102 796 standard in order to relay messages between the two client connections that are paired.
In a nutshell, the HbbTV® application on the terminal (TV Set) connects to the server on the terminal (TV Set) and the connection enters a waiting state.
At this point, the Companion Screen application should connect to the server on the terminal and the connection enters a waiting state.
The terminal (TV Set) shall pair two waiting connections according to the following rules:
therefore be inferred to have come from the HbbTV® application
client).
endpoint (and therefore be inferred to have come from a remote
client, such as a Companion Screen application).
This "tactic" should give you the desired result.