Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dgram-browserify

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dgram-browserify

dgram module for the browser thru a proxy based on socket.io

  • 0.0.13
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Kind of udp support for the browser : replace the dgram module. Behind the scene, a socket.io/udp proxy makes this possible.

dgram-browserify is a wrapper around simudp for automatic browserify support.

Be careful, for the moment, the main browserify version provides a broken implementation of Buffer. That's why this version should be used..

Installation

$ npm install dgram-browserify

Use

Server-side, the proxy server should be launched :

var server = require('http').createServer();

require('dgram-browserify').listen(server);

server.listen(8080);

Note : see listen options

Browser-side with browserify :

var dgram = require('dgram');

//be sure Buffer is present
var Buffer = require('buffer').Buffer;

var socket = dgram.createSocket('udp4');

var hello = new Buffer('hello');
socket.send(hello, 0, hello.length, 3000, 'anywhere.com');

socket.on('message', function(buf, rinfo) {
  //...
});

//you've understood, it's dgram for the browser...

FAQs

Package last updated on 10 Jun 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc