Opening custom webhooks in meteor


#1

I want to have a basic package that connects to an external piece of hardware. In node it might look a bit like this

var app = require('express')();
var server = require('http').createServer(app);
var socket = require('socket.io')(server);

var commands = net.connect(23, '192.168.0.10');

commands.on('connect', () => socket.emit('Cylon ready'));

commands.on('data', function (data) {
  socket.emit('Cylon data', data.toString('ascii'));
});

server.listen(5000, function () {
  console.log('Listening on port 5000');
});

Is there any way to translate something like this into the Meteor ecosystem? I’ve been trying but it’s hard to quite adapt correctly.