Use the Node `dgram` API in Chrome Apps
JavaScript HTML
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test remove unecessary quotes Apr 4, 2017
LICENSE standard Mar 21, 2017
index.js standard Feb 18, 2018
package.json envify@4 Mar 2, 2017

chrome-dgram npm downloads javascript style guide

Use the Node dgram API in Chrome Apps

This module lets you use the Node.js dgram (UDP) 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!

This module is used by webtorrent.


npm install chrome-dgram


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

Example UDP client/bind:

var dgram = require('chrome-dgram')

var sock = dgram.createSocket('udp4')

sock.send('beep', 0, 'beep'.length, 1337, '')

sock.on('message', function (data, rInfo) {
  console.log('Got data from ' + rInfo.address + ':' + rInfo.port)

See for full API documentation: dgram


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 Canary on Mac. If you're on Windows or Linux, feel free to send a pull request to fix this limitation.


MIT. Copyright (c) Feross Aboukhadijeh & John Hiesey.