Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google hangout desktop application flow

I am creating a screensharing application that would work in a similar manner like Google Hangout Screen Shares, and I'd like to know how the Google Talk plugin (used for Screen Shares) spawns child processes and uses a dynamic port range.

I am creating a background running application that user will have to install, and which talks with browser like how they describe here, http://www.codeproject.com/Articles/36517/Communicating-from-the-Browser-to-a-Desktop-Applic

But when I look at googleTalkPlugin, which is responsible for google hangout screen sharing, I saw that there are a lot of processes running, and whenever I open a new browser, a new talk plugin for that browser starts, as child service.

Here are some snapshots

when I started safari

when I started firefox

and when I noticed the port used by googleTalkPlugin, I came to know its dynamic! If you saw the above link, the Browser Desktop communication is on static port.

I am very interested in knowing, how do I use dynamic port numbers? Also, should I create child process for every browser? Or something better?

like image 395
Hitesh Joshi Avatar asked May 01 '13 12:05

Hitesh Joshi


People also ask

Why is Hangouts shutting down?

For most, conversations will automatically be migrated over from Hangouts to Chat. Imad is a senior reporter covering Google and internet culture.

Is Google Hangouts shutting down 2022?

As announced earlier this year, Google Hangouts will finalize its transition to Google Chat by redirecting the original Hangouts web app to Chat. Google says on a support page that hangouts.google.com will close and redirect to chat.google.com. Access to Hangouts on the web will be available until November 1, 2022.

Is there a desktop app for Google Hangouts?

Google Hangouts - Get Started with Hangouts on Desktop or Mobile. Use Google Hangouts to keep in touch with one person or a group. Available on mobile or on desktop, start making video or voice calls today.


1 Answers

The reason there is a separate child process for each browser is that the Google Talk application is implemented as a browser plugin. Each browser has a Google Talk plugin installed and doesn't know about the other browsers, their plugins or their subprocesses. Each browser will launch the plugins that it has installed and, as Eduard mentioned in the comments, some plugins are started in a separate process. This isn't behavior that is special about Google Talk, it is behavior you will see with most plugins. If you implement your application as a browser plugin you will have the same behavior. If you don't want your application to run as a subprocess of a browser then you will need to write it as a standalone application, not a browser plugin.

If you want to learn more about spawning subprocesses read up on fork(). There are lots of other good resources around the internet on subprocesses.

Your other question is around dynamic port numbers. The easiest way to do this is to bind to port 0 and you will be assigned a random open port by the operating system. You can then use getsockname() to find out what port you ended up with. If you are working with a client/server situation you can have the client do this and then just tell the server which port it is using.

like image 94
seanmk Avatar answered Oct 06 '22 12:10

seanmk