ithewei před 3 roky
rodič
revize
11bfdcce2c
3 změnil soubory, kde provedl 1 přidání a 92 odebrání
  1. 0 46
      README-CN.md
  2. 0 46
      README.md
  3. 1 0
      evpp/Channel.h

+ 0 - 46
README-CN.md

@@ -305,52 +305,6 @@ int main() {
 }
 ```
 
-**js axios 风格**
-```c++
-#include "axios.h"
-
-int main() {
-    const char* strReq = R"({
-        "method": "POST",
-        "url": "http://127.0.0.1:8080/echo",
-        "params": {
-            "page_no": "1",
-            "page_size": "10"
-        },
-        "headers": {
-            "Content-Type": "application/json"
-        },
-        "body": {
-            "app_id": "123456",
-            "app_secret": "abcdefg"
-        }
-    })";
-
-    // sync
-    auto resp = axios::axios(strReq);
-    if (resp == NULL) {
-        printf("request failed!\n");
-    } else {
-        printf("%s\n", resp->body.c_str());
-    }
-
-    // async
-    int finished = 0;
-    axios::axios(strReq, [&finished](const HttpResponsePtr& resp) {
-        if (resp == NULL) {
-            printf("request failed!\n");
-        } else {
-            printf("%s\n", resp->body.c_str());
-        }
-        finished = 1;
-    });
-
-    // wait async finished
-    while (!finished) hv_sleep(1);
-    return 0;
-}
-```
-
 ### WebSocket
 #### WebSocket服务端
 见[examples/websocket_server_test.cpp](examples/websocket_server_test.cpp)

+ 0 - 46
README.md

@@ -261,52 +261,6 @@ int main() {
 }
 ```
 
-**js axios style**
-```c++
-#include "axios.h"
-
-int main() {
-    const char* strReq = R"({
-        "method": "POST",
-        "url": "http://127.0.0.1:8080/echo",
-        "params": {
-            "page_no": "1",
-            "page_size": "10"
-        },
-        "headers": {
-            "Content-Type": "application/json"
-        },
-        "body": {
-            "app_id": "123456",
-            "app_secret": "abcdefg"
-        }
-    })";
-
-    // sync
-    auto resp = axios::axios(strReq);
-    if (resp == NULL) {
-        printf("request failed!\n");
-    } else {
-        printf("%s\n", resp->body.c_str());
-    }
-
-    // async
-    int finished = 0;
-    axios::axios(strReq, [&finished](const HttpResponsePtr& resp) {
-        if (resp == NULL) {
-            printf("request failed!\n");
-        } else {
-            printf("%s\n", resp->body.c_str());
-        }
-        finished = 1;
-    });
-
-    // wait async finished
-    while (!finished) hv_sleep(1);
-    return 0;
-}
-```
-
 ### WebSocket
 #### WebSocket server
 see [examples/websocket_server_test.cpp](examples/websocket_server_test.cpp)

+ 1 - 0
evpp/Channel.h

@@ -283,6 +283,7 @@ public:
     }
 
     // heartbeat
+    // NOTE: Beware of circular reference problems caused by passing SocketChannelPtr by value.
     void setHeartbeat(int interval_ms, std::function<void()> fn) {
         if (io_ == NULL) return;
         heartbeat = std::move(fn);