i changed a bit the format of the string, so it's easier to insert new values and read it.
Sometimes the code "hangs", need to investigate why.
sprintf (cms,"{\"method\" : \"put\",\"resource\" : \"%s\",\"params\" : {},\"headers\" : {\"X-ApiKey\":\"%s\"},\
\"body\" :{\"version\" : \"1.0.0\",\"datastreams\" :[\
{\"id\" : \"0\",\"current_value\" : \"%2.1f\"},\
{\"id\" : \"1\",\"current_value\" : \"%2.1f\"},\
{\"id\" : \"2\",\"current_value\" : \"%2.1f\"},\
{\"id\" : \"3\",\"current_value\" : \"%2.1f\"},\
{\"id\" : \"4\",\"current_value\" : \"%2.1f\"},\
{\"id\" : \"5\",\"current_value\" : \"%2.1f\"},\
{\"id\" : \"6\",\"current_value\" : \"%2.1f\"},\
{\"id\" : \"7\",\"current_value\" : \"%2.1f\"},\
{\"id\" : \"8\",\"current_value\" : \"%2.1f\"}\
]},\"token\" : \"0x%d\"}\r\n",feed,apikey,\
windaverage,windgust,tempbuiten,tempbinnen,sensor1,sensor2,sensor3,regen,hpa,\
token);
I tried the websocket library to send some Json to pachube (cosm) but didn't get too far so went to basics to test the library
I have been testing out code on the mbed socket server as follows
Now on the web interface I can open the sending page and the view page in two browser windows. Then I simply send the letter 'A' as a message , which shows in the view window as 'Message: a' exactly as expected. I get nothing at the Mbed end though untill I send the messeage 64 times then I get AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA Similarly if i send TEST in the view page I see 'message: TEST" , but i have to send this message 16 times before the mbed prinf's TESTTESTEST....... 16 times.
It seems the library is buffering 64 chars worth of messages before it will pass them to WS.read() Anyone got any ideas as to this behavior ??