Technology to read TCP socket in Google Chrome - sockets

I am looking for the latest technology in Google Chrome to read a TCP socket on the users computer and capture the data (which I will then manipulate and populate a field on the web page.) I have read about NPAPI, chrome apps and chrome extensions but each is either about to be deprecated or doesn't support TCP sockets. What method is available that will be supported for more than the next year?
I have already developed a similar addon for Internet Explorer in ActiveX that is called in javascript and works well.

Related

How to connect chrome web extension with localhost server?

I have a google chrome web extension that needs to communicate with a Qt desktop application - but how?
There is chrome's native messaging, but as I want to support multiple browsers/OS, this would be too much effort because it is only for chrome.
Then there is this post that suggests setting up a local server. This is what I did, see below.
I have set up a server with Qt with QTcpServer that uses QTcpSocket's on 127.0.0.1 (localhost). But a web extension can not listen to sockets, only chrome apps can. There are 2 possible solutions on my mind:
As a workaround, I could perhaps write a small chrome app. The Qt application would talk to the chrome extension via the chrome app (chrome apps support sockets). But I think this method is clumsy and not quite elegant.
On the other hand, I have read about socket.io.
The idea is: The chrome extension talks via http requests with socket.io, and socket.io talks via sockets with my desktop app. Is this a possible solution?
What I also tried, is to directly connect to the local server with the following code. In my Qt server application, I see that there is a new connection. But I can not get a response at all (either my Qt code is wrong or it is because extensions can not listen to sockets?)
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://localhost:12345", true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
alert('This is the response from the server: '+ xhr.responseText );
}
as you already know extensions can not create direct connections:
Google Chrome Socket API in extensions
possible solution
maybe your QT application could serve a websocket and you should be able to communicate with that from Javascript:
http://www.html5rocks.com/en/tutorials/websockets/basics/
if you are unable to serve websockets from inside the QT application, another approach could be create a "bridge" a little script that could serve a websocket to your JavaScript and pass the messages from/to the QT application
you will find plenty of examples on websockets, the easy way to get into this could be creating a little server using node.js to play with it stackabuse.com/node-js-websocket-examples-with-socket-io/
oh! and do a search for "websocket same origin policy"
Example of an extension using websockets (that will be useful for debugging): chrome.google.com/webstore/detail/simple-websocket-client/pfdhoblngboilpfeibdedpjgfnlcodoo?hl=en
hope this helps

Can I use sockets on Appengine without a special lib?

I'm confused by the GAE documentations. It says App Engine supports sockets without requiring you to import any special App Engine libraries or add any special App Engine code. but it seems misleading as just above it says App Engine supports outbound sockets through the appengine/socket package.
I would like to connect to an IMAP server using the standard net package. Is that possible or I'm stuck with the GAE sockets API?
https://cloud.google.com/appengine/docs/go/sockets/
It is not possible to open an outbound socket without going through the appengine/socket api. This is because it works through RPC and an appengine.Context is needed to do that. You can still use the IMAP library you linked, though, as it provides a function to create a client with a given net.Conn. You can get a net.Conn from appengine/socket and pass it to NewClient to do your business. The reason it works on python and java is because they both use thread local memory to manage request state implicitly, whereas the go runtime does not.
Nothing stops you from connecting to an Imap server, since you will initiate an outbound connection. For java, the standard java mail packages work out of the box.
Only for paid apps though, i.e. you need to have billing enabled.

Plans for Socket api for dart in chrome apps

Is there any plan to allow dart programs to use sockets in chrome, like chrome packaged apps are allowed to use the chrome.socket api set?
There is a package which implements the chrome* APIs in Dart at http://pub.dartlang.org/packages/chrome.
Sockets are supported by latest releases of Dart: see Socket class in dart:io library.
They can only be used in command line applications (e.g. on server-side). Sockets are currently not supported by Web browsers (you must use WebSockets which are not the same).

Deliver application's GUI via browser

I need to show to a user an interface of some application running on a server using a browser. It should be like RDP-client for a single application on a server.
Are there any solutions or services that can implement following functionality? Maybe Citrix?
Thanks in advance!
This looks like what you're looking for:
http://freerdp.net/
About FreeRDP-WebConnect
FreeRDP-WebConnect is an open source gateway for accessing RDP
sessions using any HTML5 compliant browser. In particular it relies on
the Canvas and the WebSockets feature. FreeRDP-WebConnect is a
subproject of the FreeRDP project.
On the server side, a standalone daemon - written in C++ - provides a
Web page via HTTPS (or HTTP, if configured) and uses FreeRDP libs to
connect as a client to any RDP session. The server side WebSockets
implementation handles current RFC6455 only, so browsers that
implement the older drafts do not work. With RFC6455 being raised to
the "Proposed Standard" level, this should change now really soon.
I would create an account on the server for the user, and only give it access to the one application it needs access to.
You can use Cameyo. To start, create yourself a free account, and click on "Add App". If your installer supports unattended installation, you simply need to submit it. Otherwise, you can build a Cameyo package locally and send it in. It will then be playable as HTML5.
You don't indicate what server you are running on.
As an alternative to FreeRDP-Webconnect cited above, also open source and also using FreeRDP as rdp client through an HTTP gateway, there is Myrtille.
FreeRDP-WebConnect embeds a standalone daemon written in C++ to provide a web page via HTTP(S), and so will also work on Linux servers, while Myrtille have a IIS/.NET (C#) implementation and an MSI installer, thus is more intended for Windows Servers.

Iphone programming [TCP APP] + Windows

i know that similar question are already asked some time but cant find anything that maches my "problem"
just a quick and dirty:
is there a sdk where i can programm a TCP (sending/recieveing) tool for iphone with windows?
there are some article that telling it is possible to talk tcp with html5
If html5 is a good choice for this what i need to "start" programming for iphone.
before the flame wars start: im usually coding heavly with AutoIT for my Windows tools.
Since iOS is built on UNIX, you can use any C code or libraries that uses TCP sockets. Any examples you find using C and sockets will apply. You can also use Apple's CFSocket library for more high level access.
TCP sockets are TCP sockets, they can talk to anything (Windows included) if it's on the same network.
To write the software and install it to an iPhone, you will need a Mac. For more info see How can I develop for iPhone using a Windows development machine?