Test u-blox C027, nodejs, socketio on heroku
Dependencies: C027 EthernetInterface SocketIO WebSocketClient mbed-rtos mbed
Fork of C027_Socketio_Ethernet by
Diff: main.cpp
- Revision:
- 9:b03bfd6a2094
- Parent:
- 8:958c0e7c9536
diff -r 958c0e7c9536 -r b03bfd6a2094 main.cpp --- 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); } }