Test u-blox C027, nodejs, socketio on heroku

Dependencies:   C027 EthernetInterface SocketIO WebSocketClient mbed-rtos mbed

Fork of C027_Socketio_Ethernet by Chau Vo

Files at this revision

API Documentation at this revision

Comitter:
olympux
Date:
Sun Apr 27 15:17:03 2014 +0000
Parent:
8:958c0e7c9536
Commit message:
tested

Changed in this revision

SocketIO.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/SocketIO.lib	Sun Apr 27 14:04:00 2014 +0000
+++ b/SocketIO.lib	Sun Apr 27 15:17:03 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/olympux/code/SocketIO/#d811e59b5810
+http://mbed.org/users/olympux/code/SocketIO/#e1ce1bc8b8c8
--- a/main.cpp	Sun Apr 27 14:04:00 2014 +0000
+++ b/main.cpp	Sun Apr 27 15:17:03 2014 +0000
@@ -68,22 +68,26 @@
     eth.connect();
     DBG("IP Address is %s", eth.getIPAddress());
 
+    //SocketIO socketio("websocket-server-c9-chau_vk.c9.io");
     SocketIO socketio("nne-server1.herokuapp.com");
-    //SocketIO socketio("websocketserver-tutorial11067089.rhcloud.com");
-    //SocketIO socketio("websocket-server.chau_vk.c9.io:8001");
-    //SocketIO socketio("websocket-server-c9-chau_vk.c9.io");
+    //SocketIO socketio("nneserver1-tutorial11067089.rhcloud.com");
+
+    bool c = socketio.connect();
+    //DBG("Connect result: %s", c?"OK":"Failed");
+
     Timer t;
     t.start();
-
-    bool c = socketio.connect(); // c is always false, (maybe because the connection is upgraded?)
-    DBG("Connect result: %s", c?"OK":"Failed");
-
     while (1) {
-        int res = socketio.emit("mesage","[\"mbed SocketIO Hello World!\"]");
+        socketio.connect();
+        if (t.read() > 10) {
+            socketio.emit("message","0.5");
+            DBG("sent");
+            t.reset();
+        }
         if (socketio.read(msg)) {
             DBG("rcv: %s", msg);
         }
-        wait(0.1);
+        //wait(10);
     }
 }