define([
    "Underscore",
    "yapp/yapp",
    "vendors/socket.io"
], function(_, yapp, io) {
    var logging = yapp.Logger.addNamespace("updates");
    var Updates = new (yapp.Class.extend({
        /* Constructor */
        initialize: function() {
            this.url = [window.location.protocol, '//', window.location.host].join('');
            logging.log("Connexion to "+this.url);
            this.socket = io.connect(this.url);

            // Video streaming stats
            this.socket.on('stats', function(data) {
                //logging.log("streaming stats ", data);
                this.trigger("streaming:stats", data);
            });

            // Remote control connected
            this.socket.on('remote', _.bind(function() {
                logging.log("remote is connected");
                this.trigger("remote:start");
            }, this));

            // Touch input from remote
            this.socket.on('remote_input', _.bind(function(data) {
                logging.log("remote input ", data);
                this.trigger("remote:input", data);
            }, this));

            // Search from remote
            this.socket.on('remote_search', _.bind(function(q) {
                logging.log("remote search ", q);
                this.trigger("remote:search", q);
                yapp.History.navigate("search/:q", {
                    "q": q
                });
            }, this));

            // Connexion error
            this.socket.on('error', _.bind(function(data) {
                logging.error("error in socket.io")
            }, this));
            return this;
        },
    }));

    return Updates;
});
define([
    "Underscore",
    "yapp/yapp",
    "vendors/socket.io"
], function(_, yapp, io) {
    var logging = yapp.Logger.addNamespace("updates");
    var Updates = new (yapp.Class.extend({
        /* Constructor */
        initialize: function() {
            this.url = [window.location.protocol, '//', window.location.host].join('');
            logging.log("Connexion to "+this.url);
            this.socket = io.connect(this.url);

            // Video streaming stats
            this.socket.on('stats', _.bind(function(data) {
                //logging.log("streaming stats ", data);
                this.trigger("streaming:stats", data);
            }, this));

            // Remote control connected
            this.socket.on('remote', _.bind(function() {
                logging.log("remote is connected");
                this.trigger("remote:start");
            }, this));

            // Touch input from remote
            this.socket.on('remote_input', _.bind(function(data) {
                logging.log("remote input ", data);
                this.trigger("remote:input", data);
            }, this));

            // Search from remote
            this.socket.on('remote_search', _.bind(function(q) {
                logging.log("remote search ", q);
                this.trigger("remote:search", q);
                yapp.History.navigate("search/:q", {
                    "q": q
                });
            }, this));

            // Connexion error
            this.socket.on('error', _.bind(function(data) {
                logging.error("error in socket.io")
            }, this));
            return this;
        },
    }));

    return Updates;
});
Correct error in client for streaming
Correct error in client for streaming
