Skip to content

Instantly share code, notes, and snippets.

@tjfontaine
Created July 30, 2014 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjfontaine/a704161854e49120389e to your computer and use it in GitHub Desktop.
Save tjfontaine/a704161854e49120389e to your computer and use it in GitHub Desktop.
function DgramStream(type, port) {
if (!(this instanceof DgramStream))
return new DgramStream(type, port);
ReadableStream.call(this);
this._socket = dgram.createSocket(type);
this._socket.bind(port);
this._socket.on('message', function(msg, rinfo) {
self.push(msg);
});
}
util.inherits(DgramStream, Readable);
DgramStream.prototype._read = function dgsRead() {
// what would this even do?
// what about pause/resume?
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment