Simple websocket client based on the original with a few added features such as: - setBaud() - set the baud rate for the communication - Initialize() - mimics the constructor - chaged read() to readmsg() to avoid confusion with other functions

Dependents:   IoT_Ex BatteryModelTester BatteryModelTester

Fork of WebSocketClient by Samuel Mokrani

Revision:
11:85bff70bab45
Parent:
10:fc40c56e8a3c
Child:
12:0979caf96fa6
--- a/Websocket.cpp	Wed Mar 30 09:05:44 2016 +0000
+++ b/Websocket.cpp	Wed Mar 30 10:40:05 2016 +0000
@@ -4,7 +4,7 @@
 #define MAX_TRY_READ 10
 
 //Debug is disabled by default
-#if 1
+#if 0
 #define DBG(x, ...) std::printf("[WebSocket : DBG]"x"\r\n", ##__VA_ARGS__); 
 #define WARN(x, ...) std::printf("[WebSocket : WARN]"x"\r\n", ##__VA_ARGS__); 
 #define ERR(x, ...) std::printf("[WebSocket : ERR]"x"\r\n", ##__VA_ARGS__); 
@@ -21,6 +21,15 @@
     socket.set_blocking(false, 400);
 }
 
+Websocket::Websocket() {
+    
+}
+
+void Websocket::Initialize(char * url){
+    fillFields(url);
+    socket.set_blocking(false, 400);
+}
+
 void Websocket::fillFields(char * url) {
   int ret = parseURL(url, scheme, sizeof(scheme), host, sizeof(host), &port, path, sizeof(path));
   if(ret)