Last active
December 21, 2015 12:09
-
-
Save jcrugzz/6304245 to your computer and use it in GitHub Desktop.
Used for testing how the error propagation is handled in the internal streams
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var godot = require('godot'); | |
var server = godot.createServer({ | |
type: 'tcp', | |
reactors: [ | |
godot.reactor() | |
.console() | |
.map(function (data, callback) { | |
callback(new Error('WHOOPS GAIZ')); | |
}, { passThrough: true }) | |
.console() | |
] | |
}); | |
server.on('error', function (err) { | |
console.error('godot server error: ' + err); | |
}); | |
var client = godot.createClient({ | |
type: 'tcp', | |
producers: [ | |
godot.producer({ | |
host: '127.0.0.1', | |
service: 'godot/test', | |
state: 'test', | |
metric: 1, | |
ttl: 1000 * 5 | |
}) | |
] | |
}); | |
server.listen(3000, function () { | |
client.connect(3000); | |
client.on('error', function (err) { | |
console.error('godot client error: ' + err); | |
}) | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment