TCP Listen, a new API for Chrome Packaged Apps – re-posting from the Chromium blog.
Chrome packaged apps aim to deliver an app experience with the appearance and capabilities of native apps, but built using the growing capabilities of HTML5. These apps can access APIs for better filesystem handling, direct access to hardware devices, raw network communication andmany others. One of the new APIs that just landed in an experimental state is TCP Listen, which allows an app to accept incoming TCP connections.
Since the developer preview launch earlier this year, Chrome packaged apps have been able to connect to remote servers using TCP or UDP, and bind to a UDP port. For example, this Media Center application searches for and connects to media servers in the local network. Now, through the new TCP Listen API, a Chrome packaged app can also act as a TCP server itself and accept incoming connections on specified ports.
You can use this API, for example, to create a HTTP server on a development environment application, to automate a browser window for page load testing (see image below) or even to augment the Media Center application with a DLNA®/UPnP media server and show your PicasaWeb pictures on your DLNA® enabled television.
To get started, clone this GitHub repository and look at the webserver and the TCP server samples. You may also want to watch the Chrome Apps Office Hours where we specifically talk about the TCP Listen API.
We are curious to see what clever ideas you will come up with. Have questions or comments? Subscribe to chromium-apps and let us know!