Use the Node `net` API in Chrome Apps
JavaScript HTML
Latest commit a4d7761 Apr 4, 2017 @feross remove unnecessary quotes
Failed to load latest commit information.
test remove unnecessary quotes Apr 4, 2017
LICENSE add me (Jan) as contributor Jan 11, 2016 standard Mar 21, 2017
index.js standard fixes Jul 25, 2016
package.json browserify@14 Jan 25, 2017

chrome-net npm downloads javascript style guide

Use the Node net API in Chrome Apps

This module lets you use the Node.js net (TCP) API in Chrome Packaged Apps.

Instead of learning the quirks of Chrome's chrome.sockets API for networking in Chrome Apps just use the higher-level node API you're familiar with. Then, compile your code with browserify and you're all set!


npm install chrome-net


Use node's net API, including all parameter list shorthands and variations.

Example TCP client:

var net = require('chrome-net')

var client = net.createConnection({
  port: 1337,
  host: ''


client.on('data', function (data) {

// .pipe() streaming API works too!

Example TCP server:

var net = require('chrome-net')

var server = net.createServer()

server.on('listening', function () {

server.on('connection', function (sock) {
  console.log('Connection from ' + sock.remoteAddress + ':' + sock.remotePort)
  sock.on('data', function (data) {


See for full API documentation: net


To run tests, use npm test. The tests will run TCP and UDP servers and launch a few different Chrome Packaged Apps with browserified client code. The tests currently require Chrome on Windows or Chrome Canary on Mac. If you're on Linux, feel free to send a pull request to fix this limitation.


MIT. Copyright (c) Feross Aboukhadijeh, John Hiesey & Jan Schär.