Communication between React Native Mobile App and React.js Hbbtv App - reactjs

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.

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:
One waiting connection shall be on the local service endpoint (and
therefore be inferred to have come from the HbbTV® application
client).
One other waiting connection shall be on the remote service
endpoint (and therefore be inferred to have come from a remote
client, such as a Companion Screen application).
The app-endpoint portion of the resource name used in the client handshake request shall match between both waiting connections.
This "tactic" should give you the desired result.

Related

Connect to SIP server from React Application for audio and video video communication

I'm new to the world of VoIP. I've built a client side app in Reactjs that needs to connect with a SIP server to make and receive calls. Any help on how to connect to the SIP server and how to steam audio and video.
react-native-jssip should offer the JavaScript SIP extension:
https://www.npmjs.com/package/react-native-jssip
Then you need to setup a SIP server with websocket/webrtc support, like Asterisk, FreeSwitch or Kamailio. For the latest, instructions for a sample deployment are available at:
https://github.com/havfo/WEBRTC-to-SIP

Is there any way so that my angular app can connect to scanner?

I want my angular app to detect scanner and perform scanning functionalities? how will i get this functionality in my app?
That depends on the type of scanner you are using.
Most scanners connected to a network have an IP. You can login to the scanner at that IP to configure it. But they may not expose an API to send/receive instructions.
Browsers are not designed to connect with scanners. If you want to achieve this through the browser, you will need a server in the middle to receive instructions from client and pass them on to the scanner.

is there any way to make remote desktop client using channel API GAE?

I have read about Remote Desktop Client with AngularJS and Yeoman.It is using sockets internally.
http://blog.mgechev.com/2014/02/08/remote-desktop-vnc-client-with-angularjs-and-yeoman/
As my angular app is deployed on GAE and I have implemented channel API for notifications. So is there any way to use channel API for the same?
Or any other best way to do the same?
The simple answer is: No, the approach documented by the provided link will not work on "normal" app engine.
Here a couple of reasons:
It uses a continuous socket connection to connect to the VNC server
It uses server sockets* to provide a stream to Yeoman VNC
The Channel API is not an appropriate replacement for sockets
*) App Engine doesn't allow you to open listening sockets. Having the 60 second / 10 minute deadlines in place it wouldn't be practical anyway (unless manually scaled and thus taking all the good out of app engine)
I just wrote an extended answer on a slightly similar question here. Some of the points there could be of interest to you.
Consider using App Engine Managed VM. I believe you can also run node.js application on managed vms.

Ionic framework - detect internet connection

I am developing simple application using Ionic framework (and AngularJs) that fetches json data from my webpage. How can I detect is there "internet connection" and display message to user: "Connect to internet" if not.
EDIT
Can I use cordova API for that ?
Cordova provides org.apache.cordova.network-information plugin.
See documentation HERE
This plugin provides an implementation of an old version of the Network Information API. It provides information about the device's cellular and wifi connection, and whether the device has an internet connection.
If I am not mistaken, this plugin only detects whether the Wi-Fi or Cellular networking is enabled on the device. This does not always mean that the application can actually reach your remote server, if you are connected to the WiFi network without internet connection.
Therefore, the only solution I have found to ensure that the application can reach your remote server is to continuously ping the server.

websockets with mobile clients

Is is must to have the client to be browser for a web server? Is this a good architecture for mobile clients to have some non browser client and get data from webservers?
I am thinking of implementing a basic browser at mobile client. Login using web methos and rest of the communication (monitoring info at every 10sec) be done using web sockets. Will this work?
Can I implement web sockets without JS?
Thanks
You can implement WebSockets outside the browser, and without any JavaScript involved. You could have i.e. a Android native Java application that talks to a server over WebSockets.
WebSockets is a protocol. The WebSockets API defined for JavaScript running in the browser is something different.
You can authenticate a WebSockets connection during the WebSockets handshake using any method available with HTTP (i.e. basic auth, digest, cram-md5, client cert.-based (TLS), and so on), since the WebSockets handshake is still like any other HTTP conversation. It is only after the handshake is completed that WS is different from HTTP.
Note, that what you likely want on the server side is not a plain old Web server, but a WebSockets server/framework.
Whether using WS to connect mobile clients is "a good architecture" is a bit vague. I would say: if you decide to have your mobile client talk to a server, and that server is under your control, and you want to leverage WS advantages like near real-time/bidirectional, then it might be good. Better than cooking your own low-level protocol.

Resources