Apple TV TVML socket.io implementation
<p>Currently I'm trying to make an app for my Apple TV using TVMLKit JS. After working with general TVML I would like to add a socket connection to my computer.</p>

<p>I've followed the socket.io <a href="http://socket.io/get-started/chat/" rel="nofollow noreferrer">chat tutorial</a> and the <a href="https://developer.apple.com/library/content/documentation/TVMLKitJS/Conceptual/TVMLProgrammingGuide/ExpandingYourApp.html#//apple_ref/doc/uid/TP40016718-CH3-SW2" rel="nofollow noreferrer">TVML tutorial</a>, but now I wanna like mix them up.</p>

<p>After <a href="https://developer.apple.com/reference/tvmljs/1627369-evaluatescripts" rel="nofollow noreferrer">reading this</a>, I came up with this:</p>

<pre><code>var baseURL;
var templatesURL;
var imagesURL;
var jsURL;
var socket;

function setPath(url) {
    baseURL = url;
    templatesURL = baseURL + "templates/";
    imagesURL = baseURL + "images/";
    jsURL = baseURL + "js/";
}

/**
 * App launch
 * @param options
 */
App.onLaunch = function(options) {
    setPath(options.BASEURL);

    var javascriptFiles = [
        jsURL + "socket.io.js"
    ];

    evaluateScripts(javascriptFiles, function(success) {
        if (success) {
            getDocument("home.xml");
            socket = io("http://localhost:3000");
            socket.on('connect', console.log("Connected"));
        } else {
            alertTemplate("Evaluate Scripts Error","There was an error attempting to evaluate the external JavaScript files. Please check your network connection and try again later.");

            throw ("Error: unable to evaluate scripts.");
        }
    });
}
</code></pre>

<p>I've left out the alertTemplate and loadingTemplate functions but they work correctly. The code above always ends up in the else case. (socket.io.js is <a href="https://github.com/socketio/socket.io-client/blob/master/dist/socket.io.js" rel="nofollow noreferrer">downloaded from here</a>)</p>

<p>Maybe this seems like I'm too lazy to find it out myself but I've been stuck with it for a couple of hours(!) already.</p>

<p>P.S. possible sources to that load external js libraries/socket.io which didn't help me out so far but might help: <a href="https://gist.github.com/jedi4ever/fbdb4938620293bfc5a0" rel="nofollow noreferrer">Help1</a> and <a href="https://github.com/emadalam/tvml-catalog-using-atvjs" rel="nofollow noreferrer">Help2</a>
(advanced but uses external libraries aswell and it does seems to have nice function for dynamic templates using handlebars)</p>

<p>Any help is welcome.</p>