Skip to content

Commit 8b604da

Browse files
committed
refactor(websocket): align with vix::http namespace
- migrate HttpApi and internal usage from vix::vhttp to vix::http - update examples to reflect new HTTP layer - adjust metrics integration - update changelog no behavior change
1 parent 84decba commit 8b604da

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99
## [1.11.0] - 2026-03-24
1010

11-
- Refactored WebSocket module to use native vix::vhttp layer
11+
- Refactored WebSocket module to use native vix::http layer
1212
- Removed implicit dependencies on Boost-based HTTP internals
1313
- Updated server, client and session implementations to new core API
1414
- Simplified protocol handling and routing integration

examples/advanced/src/server.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ int main()
257257

258258
httpApp.get(
259259
"/ws/poll",
260-
[lpBridge](vix::vhttp::Request &req,
261-
vix::vhttp::ResponseWrapper &res)
260+
[lpBridge](vix::http::Request &req,
261+
vix::http::ResponseWrapper &res)
262262
{
263263
const std::string sessionId = req.query_value("session_id");
264264
if (sessionId.empty())
@@ -290,8 +290,8 @@ int main()
290290

291291
httpApp.post(
292292
"/ws/send",
293-
[lpBridge](vix::vhttp::Request &req,
294-
vix::vhttp::ResponseWrapper &res)
293+
[lpBridge](vix::http::Request &req,
294+
vix::http::ResponseWrapper &res)
295295
{
296296
njson j;
297297
try
@@ -349,7 +349,7 @@ int main()
349349

350350
httpApp.get(
351351
"/health",
352-
[](vix::vhttp::Request &, vix::vhttp::ResponseWrapper &res)
352+
[](vix::http::Request &, vix::http::ResponseWrapper &res)
353353
{
354354
res.ok().json(njson{
355355
{"status", "ok"},

include/vix/websocket/HttpApi.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ namespace vix::websocket::http
112112
*
113113
* Works for:
114114
* - boost::beast::http::request: req.target() -> string_view
115-
* - vix::vhttp::Request: req.target() -> std::string
115+
* - vix::http::Request: req.target() -> std::string
116116
*/
117117
template <typename Request>
118118
inline std::string request_target_string(const Request &req)
@@ -121,7 +121,7 @@ namespace vix::websocket::http
121121
}
122122

123123
/**
124-
* @brief Get query parameter (supports vix::vhttp::Request or Beast-like target parsing).
124+
* @brief Get query parameter (supports vix::http::Request or Beast-like target parsing).
125125
*/
126126
template <typename Request>
127127
inline std::optional<std::string> get_query_param(const Request &req, std::string_view key)
@@ -153,7 +153,7 @@ namespace vix::websocket::http
153153
}
154154

155155
/**
156-
* @brief Parse JSON body (supports vix::vhttp::Request::json() when available).
156+
* @brief Parse JSON body (supports vix::http::Request::json() when available).
157157
*
158158
* Returns an optional JSON; may be empty if body is empty or parsing fails.
159159
*/

src/Metrics.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ namespace vix::websocket
175175

176176
std::string make_response_text(int status, std::string_view content_type, std::string body)
177177
{
178-
vix::vhttp::Response res;
178+
vix::http::Response res;
179179
res.set_status(status);
180180
res.set_header("Server", "vix-ws-metrics");
181181
res.set_header("Cache-Control", "no-store");
@@ -198,14 +198,14 @@ namespace vix::websocket
198198
if (parsed && is_metrics_request(*parsed))
199199
{
200200
wire = make_response_text(
201-
vix::vhttp::OK,
201+
vix::http::OK,
202202
"text/plain; version=0.0.4; charset=utf-8",
203203
metrics.render_prometheus());
204204
}
205205
else
206206
{
207207
wire = make_response_text(
208-
vix::vhttp::NOT_FOUND,
208+
vix::http::NOT_FOUND,
209209
"text/plain; charset=utf-8",
210210
"Not Found\n");
211211
}

0 commit comments

Comments
 (0)