Websocket communication

Dependents:   Ethernet

Revision:
0:c10e8dc4cffd
diff -r 000000000000 -r c10e8dc4cffd WebSocket_COMM.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WebSocket_COMM.cpp	Sun Apr 03 15:44:52 2016 +0000
@@ -0,0 +1,27 @@
+#include "WebSocket_COMM.h"
+
+WebSocket_Communication::WebSocket_Communication(string _url)
+{
+    url = new char[_url.length()+1];
+    strcpy(url, _url.c_str());
+    
+    printf("URL : %s \n",url);
+    webSocket = new Websocket(url);
+}
+
+void WebSocket_Communication::initWebSocket()
+{
+    
+    int nbTry = 0;
+    while(!webSocket->connect() && nbTry <3)
+    {
+        printf("Connot connect Websocket, retrying \n");
+        ++nbTry;
+        wait(0.75);
+    }
+}
+
+void WebSocket_Communication::sendDataWebSocket(char *data)
+{
+    webSocket->send(data);
+}
\ No newline at end of file