Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple instances of the CasparCG object seems to collide. #15

Open
coral opened this issue Apr 29, 2013 · 8 comments
Open

Multiple instances of the CasparCG object seems to collide. #15

coral opened this issue Apr 29, 2013 · 8 comments
Labels

Comments

@coral
Copy link

coral commented Apr 29, 2013

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.

@respectTheCode
Copy link
Owner

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.

@coral
Copy link
Author

coral commented May 27, 2013

Ah! I am trying to find the bug right now in the code.

respectTheCode added a commit that referenced this issue May 28, 2013
@respectTheCode
Copy link
Owner

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.

@coral
Copy link
Author

coral commented May 28, 2013

I can test the fix tomorrow for you!

@coral
Copy link
Author

coral commented Jun 14, 2013

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. (/var/www/node/node_modules/caspar-cg/lib/connection.js:222:4)
at Socket.EventEmitter.emit (events.js:95:17)
at Socket. (stream_readable.js:699:14)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable
(_stream_readable.js:382:10)
at emitReadable (_stream_readable.js:377:5)
at readableAddChunk (_stream_readable.js:142:7)
at Socket.Readable.push (_stream_readable.js:112:10)
at TCP.onread (net.js:511:21)

@respectTheCode
Copy link
Owner

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?

@coral
Copy link
Author

coral commented Jun 14, 2013

Seems to work with the new commit by some reason???
I don't get the error after fetching it.

@coral
Copy link
Author

coral commented Jun 16, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants