Mercurial
changeset 180:3a4ebe4552bf
Remove playground file as it is not needed to be tracked.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Mon, 19 Jan 2026 08:05:02 -0800 |
| parents | ce05514681c6 |
| children | a2720eac50ce |
| files | playground/main.c |
| diffstat | 1 files changed, 0 insertions(+), 102 deletions(-) [+] |
line wrap: on
line diff
--- a/playground/main.c Mon Jan 19 05:40:22 2026 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -#include "seobeo/seobeo.h" - -void Test_Echo() -{ - printf("\n=== Test: Multiple Messages ===\n"); - Seobeo_WebSocket *p_ws = Seobeo_WebSocket_Connect("wss://mrjunejune.com/echo"); - if (!p_ws) - { - printf("Failed to connect\n"); - return; - } - - const char *messages[] = { - "Message 1", - "Message 2", - "Message 3" - }; - - for (int i = 0; i < 3; i++) - { - printf("Sending: %s\n", messages[i]); - Seobeo_WebSocket_Send_Text(p_ws, messages[i]); - usleep(100000); - } - - printf("Receiving responses...\n"); - int received = 0; - int attempts = 0; - - while (received < 3 && attempts < 200) - { - Seobeo_WebSocket_Message *p_msg = Seobeo_WebSocket_Receive(p_ws); - if (p_msg) - { - if (p_msg->opcode == SEOBEO_WS_OPCODE_TEXT) - { - printf("Response %d: %.*s\n", received + 1, (int)p_msg->length, (char*)p_msg->data); - received++; - } - Seobeo_WebSocket_Message_Destroy(p_msg); - } - - usleep(10000); - attempts++; - } - printf("Received %d/%d messages\n", received, 3); - Seobeo_WebSocket_Destroy(p_ws); -} - -void Test_Chat() -{ - printf("\n=== Test: Multiple Messages ===\n"); - - Seobeo_WebSocket *p_ws = Seobeo_WebSocket_Connect("ws://127.0.0.1:8080/chat"); - if (!p_ws) - { - printf("Failed to connect\n"); - return; - } - - const char *messages[] = { - "Message 1", - "Message 2", - "Message 3" - }; - - for (int i = 0; i < 3; i++) - { - printf("Sending: %s\n", messages[i]); - Seobeo_WebSocket_Send_Text(p_ws, messages[i]); - usleep(100000); - } - - printf("Receiving responses...\n"); - int received = 0; - int attempts = 0; - - while (received < 3 && attempts < 200) - { - Seobeo_WebSocket_Message *p_msg = Seobeo_WebSocket_Receive(p_ws); - if (p_msg) - { - if (p_msg->opcode == SEOBEO_WS_OPCODE_TEXT) - { - printf("Response %d: %.*s\n", received + 1, (int)p_msg->length, (char*)p_msg->data); - received++; - } - Seobeo_WebSocket_Message_Destroy(p_msg); - } - - usleep(10000); - attempts++; - } - printf("Received %d/%d messages\n", received, 3); - Seobeo_WebSocket_Destroy(p_ws); -} - -int main(int argc, char *argv[]) -{ - - Test_Echo(); -}