Use the Node <code>net</code> API in Chrome 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
net API, including all parameter list shorthands and variations.
Example TCP client:
var net =var client = netclientclient// .pipe() streaming API works too!
Example TCP server:
var net =var server = netserverserverserver
See nodejs.org 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.