diff seobeo/s_web.c @ 121:7b1719fa918c

[Seobeo] Added web socket server.
author June Park <parkjune1995@gmail.com>
date Thu, 08 Jan 2026 06:45:10 -0800
parents c39582f937e5
children dbf14f84d51c
line wrap: on
line diff
--- a/seobeo/s_web.c	Thu Jan 08 03:19:59 2026 -0800
+++ b/seobeo/s_web.c	Thu Jan 08 06:45:10 2026 -0800
@@ -134,6 +134,17 @@
   void *p_path_kv = Dowa_HashMap_Get_Ptr(p_req_map, "Path");
   const char *path = p_path_kv ? ((Seobeo_Request_Entry*)p_path_kv)->value : "/";
 
+  // --- Check for WebSocket upgrade request ---
+  if (Seobeo_WebSocket_Server_Handle_Upgrade(p_cli_handle, p_req_map, path))
+  {
+    Seobeo_Log(SEOBEO_INFO, "WebSocket connection established\n");
+    if (p_request_arena)
+      Dowa_Arena_Free(p_request_arena);
+    if (p_response_arena)
+      Dowa_Arena_Free(p_response_arena);
+    return;
+  }
+
   // --- Try to match API route first ---
   Seobeo_Route_Handler handler = Seobeo_Router_Find_Handler(method, path, &p_req_map, p_request_arena);
   if (handler != NULL)