Open coral opened 11 years ago
Looks like the net
client is scoped incorrectly. I only have one box at the moment so I hadn't noticed. Should be an easy fix. I'll take a look.
Ah! I am trying to find the bug right now in the code.
I wrote a fix but haven't had a chance to test it. The problem is that the net
client is not part of the instance and opening a second connection replaces the first one. The first connection is still open but nothing is referencing it.
I can test the fix tomorrow for you!
I am getting the following after a while:
/var/www/node/node_modules/caspar-cg/lib/connection.js:151
this.client.write(commandQueue[0].cmd);
^
TypeError: Cannot call method 'write' of undefined
at finishedCommand (/var/www/node/node_modules/caspar-cg/lib/connection.js:151:16)
at Socket.
I looked over the code and found a couple of places that were using this
instead of self
. None of them should have caused a problem though. I just pushed a commit that fixes those.
If you turn on the debug option it will log most everything that happens. Can you post what is logged when this happens?
Seems to work with the new commit by some reason??? I don't get the error after fetching it.
Did this simple test and doesn't seem to work :(
var CasparCG = require("caspar-cg"); var async = require("async"); var io = require('socket.io').listen(3000);
ccg = new CasparCG({ host: "10.76.255.25", port: 5250, debug: true });
ccg_asd = new CasparCG({ host: "10.76.255.181", port: 5250, debug: true });
io.sockets.on('connection', function (socket) {
ccg.connect(function () {
socket.emit('control');
});
ccg_asd.connect(function () {
socket.emit('control2');
});
socket.on('key', function (data) {
var data = "<templateData>" +
"<componentData id=\\\"keyCode\\\"><data id=\\\"number\\\" value=\\\"" + data.code + "\\\" /></componentData>"+
"</templateData>";
ccg.updateTemplateData("1-1", data);
ccg_svt.updateTemplateData("1-1", data);
});
});
Both connect to 181.
Recently did a project where I had to use multiple servers. The node library seems to collide when setting up multiple objects with different configs. It only uses the last set object and writes everything to that.
Will post code later today.