fe9lix / Tuio.js

TUIO Reference Implementation for JavaScript
GNU General Public License v2.0
95 stars 26 forks source link

Express code deprecated #6

Open HeroicNate opened 8 years ago

diegoMontesinos commented 8 years ago

Yeah, the server.js code is deprecated. I try this:

// Create the tuio server and express app
var express = require("express");
tuioServer = require("tuio");
var _socketPort = express().listen(5000, function () {

    // Init TUIO client
    tuioClient = new Tuio.Client({
        host: "http://localhost:" + TUIO_SERVER_PORT
    });

    // Attach events
    tuioClient.on("connect"          , onTuioConnect);
    tuioClient.on("addTuioCursor"    , onAddTuioCursor);
    tuioClient.on("updateTuioCursor" , onUpdateTuioCursor);
    tuioClient.on("removeTuioCursor" , onRemoveTuioCursor);
    tuioClient.on("addTuioObject"    , onAddTuioObject);
    tuioClient.on("updateTuioObject" , onUpdateTuioObject);
    tuioClient.on("removeTuioObject" , onRemoveTuioObject);
    tuioClient.on("refresh"          , onRefresh);
    tuioClient.connect();
});

// Init the TUIO server
tuioServer.init({
    oscPort: 3334,
    oscHost: "0.0.0.0",
    socketPort: _socketPort
});