Debug Version

Fork of WebSocketClient by Samuel Mokrani

Files at this revision

API Documentation at this revision

Comitter:
komoritan
Date:
Sat Feb 14 00:28:52 2015 +0000
Parent:
7:4567996414a5
Commit message:
Customized

Changed in this revision

Websocket.cpp Show annotated file Show diff for this revision Revisions of this file
Websocket.h Show annotated file Show diff for this revision Revisions of this file
diff -r 4567996414a5 -r 53d05ccff94a Websocket.cpp
--- a/Websocket.cpp	Fri Feb 08 12:33:04 2013 +0000
+++ b/Websocket.cpp	Sat Feb 14 00:28:52 2015 +0000
@@ -4,7 +4,7 @@
 #define MAX_TRY_READ 10
 
 //Debug is disabled by default
-#if 0
+#if 1
 #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__); 
@@ -16,10 +16,17 @@
 
 #define INFO(x, ...) printf("[WebSocket : INFO]"x"\r\n", ##__VA_ARGS__); 
 
+Websocket::Websocket(){
+    socket.set_blocking(false, 400);
+}
 Websocket::Websocket(char * url) {
     fillFields(url);
     socket.set_blocking(false, 400);
 }
+void Websocket::set_server(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));
diff -r 4567996414a5 -r 53d05ccff94a Websocket.h
--- a/Websocket.h	Fri Feb 08 12:33:04 2013 +0000
+++ b/Websocket.h	Sat Feb 14 00:28:52 2015 +0000
@@ -74,6 +74,9 @@
         * @param url The Websocket url in the form "ws://ip_domain[:port]/path" (by default: port = 80)
         */
         Websocket(char * url);
+        Websocket();
+
+        void set_server(char * url);
 
         /**
         * Connect to the websocket url