Mercurial
diff playground/main.c @ 179:8d17f6e6e290
[ThirdParty] Added emsdk bazel rules that can be supported by bazel 9.0.0
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Thu, 22 Jan 2026 21:23:17 -0800 |
| parents | 7387eec8e7f8 |
| children |
line wrap: on
line diff
--- a/playground/main.c Thu Jan 22 20:10:30 2026 -0800 +++ b/playground/main.c Thu Jan 22 21:23:17 2026 -0800 @@ -1,102 +1,6 @@ -#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() +int main() { - 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 a = 0; + a += 1; + return a; } - -int main(int argc, char *argv[]) -{ - - Test_Echo(); -}