1 Reply Latest reply on Feb 20, 2015 1:47 PM by CMata_Intel

    Help! -Modifying a simple socketIO server to USE MRAA library with Edison

    eco_bach

      I spent the last week working with the CylonJS framework on my edison using a Maxbotix sensor.

      Everyting works with a web client on the front end.

      However at the last moment I can't get the edison to talk to an existing AIR client which I must use.

      Something to do with how socketIO is implemented in Cylon.

       

      The following simple socketIO server works for me. What I need to do is incorporate support for the mraa library and get analogue input from the Maxbotix sensor.

       

      Can anyone please help? I'm up against a deadline!!!

       

       

          var express = require('express');

          var app = express();

          var server = require('http').createServer(app);

          var io = require('socket.io').listen(server,{transports:['flashsocket', 'websocket', 'htmlfile', 'xhr-polling', 'jsonp-polling']});

           var port = Number(8080);

          server.listen(port);

           app.use(express.static(__dirname + '/'));

           var temp;

           var _this = this;

           io.on('connection', function (socket) {

            console.log('connection '+socket)

           socket.on("data",function(d){console.log('data from flash: ',d);});

            socket.emit("message","wtfwtwftwftwf hello from server");

            socket.on('disconnect', function (socket) {

            console.log("disconnect");

        });

       

        console.log('_this ='+_this);

        _this.socket=socket;

       

       

      });