Example using MbedJSONRpc: call distant method

Dependencies:   MbedJSONRpc EthernetNetIf mbed DNSResolver MbedJSONValue

Revision:
2:d439eefcc605
Parent:
0:b7259f428f5f
--- a/main.cpp	Thu Sep 22 12:33:32 2011 +0000
+++ b/main.cpp	Mon Oct 03 09:00:22 2011 +0000
@@ -6,21 +6,23 @@
 Serial pc(USBTX, USBRX);
 
 //websocket: configuration with sub-network = samux and mbed_id = mbed_acc 
-Websocket webs("ws://sockets.mbed.org:888/ws/samux/client");
+Websocket webs("ws://sockets.mbed.org/rpc/samux/mbed_client");
 
 //RPC object attached to the websocket server
 MbedJSONRpc rpc(&webs);
 
 int main() {
 
+    pc.printf("\x1B[2J");
+    pc.printf("\x1B[H");
+    
     RPC_TYPE t;
     
     //in: argument for the distant method (here empty)
     //out results of the distant method (accelerometers values)
     MbedJSONValue in, out;
 
-    while (!webs.connect())
-        pc.printf("cannot connect websocket, retrying\r\n");
+    while (!webs.connect());
 
     //CALL getAcc on mbed_acc
     if ((t = rpc.call("getAcc", "mbed_acc", in, out)) == CALL_OK) {