Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proper way to listen as TCP server in Chrome extension

I want to create a TCP server and listen on it. I need access to the tab content, so I need a chrome extension. Sadly, only chrome apps can create TCP servers.

Is it a valid/good concept to create a TCP server in a chrome app and let the app communicate with an extension (is this even possible?)?

If not, what would be my alternatives? The only idea I have is to change from server model to client model and let the extension connect to an external server. This solution would be poor in my situation, so I try to avoid it as best as I can.

What I want to achieve is that I can build a chrome extension that modifies/refreshes content with remote access (nothing malicious). External programs should be able to connect to the extension (or: the app) and send their commands to it.

like image 587
The Wavelength Avatar asked Sep 07 '14 22:09

The Wavelength


1 Answers

Yes it's a good idea.

1°) You should create a Chrome App Web Server (based on https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/webserver for example, or any other HTTP s)

2°) Then you should request it from any javascripted web page via XmlHttpRequest.

+++: No need for Chrome Extension. Should work with any modern browser on Windows / Mac / Linux with Chrome 33+ installed.

like image 62
Supersharp Avatar answered Nov 01 '22 02:11

Supersharp