Skip to content

Commit 5fbaeba

Browse files
v1.35.3: cli new generates modern vix.json for libs (#325)
1 parent 6248829 commit 5fbaeba

File tree

5 files changed

+76
-85
lines changed

5 files changed

+76
-85
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
---
99

1010
## [Unreleased]
11+
## v1.35.3
12+
13+
### Changed
14+
15+
- **CLI (new)** : Generate modern `vix.json` for header-only libraries.
16+
- Replace deprecated `repo` field with `repository`.
17+
- Set `type` to `"header-only"` for `--lib` template.
18+
- Add `include`, `keywords`, and `authors` fields to generated manifest.
19+
20+
### Notes
21+
22+
This is a patch release improving CLI scaffolding consistency with the Vix Registry specification.
23+
No runtime behavior changes.
24+
1125
## v1.35.2
1226

1327
### Fixed

README.ja.md

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Vix.cpp
22

33
<p align="center" style="margin:0;">
4-
<img
5-
src="https://res.cloudinary.com/dwjbed2xb/image/upload/v1762524350/vixcpp_etndhz.png"
6-
alt="Vix.cpp Banner"
7-
width="100%"
4+
<img
5+
src="https://res.cloudinary.com/dwjbed2xb/image/upload/v1762524350/vixcpp_etndhz.png"
6+
alt="Vix.cpp Banner"
7+
width="100%"
88
style="
99
display:block;
1010
height:auto;
@@ -32,23 +32,23 @@
3232

3333
目標は明確です。
3434

35-
> **Node / Deno / Bun のようなアプリを実行でき、
35+
> **Node / Deno / Bun のようなアプリを実行でき、
3636
> しかも不安定で低品質な「現実世界のネットワーク」を前提に設計されたランタイム**
3737
38-
Vix は単なるバックエンドフレームワークではありません。
38+
Vix は単なるバックエンドフレームワークではありません。
3939
これは **モジュラー構成のランタイム**であり、分散アプリケーション、エッジシステム、オフラインデバイス、そして従来のクラウド前提フレームワークが機能しない環境向けに設計されています。
4040

41-
**FastAPI**, **Vue.js**, **React**、最新のランタイムに着想を得つつ、
41+
**FastAPI**, **Vue.js**, **React**、最新のランタイムに着想を得つつ、
4242
**C++20 によってゼロから再設計**され、圧倒的な速度と完全な制御性を実現しています。
4343

4444
---
4545

4646
# ⚡ ベンチマーク(更新版 — 二〇二五年 十二月)
4747

48-
すべてのベンチマークは **wrk** を使用して実行されました。
48+
すべてのベンチマークは **wrk** を使用して実行されました。
4949
**八スレッド / 八百接続 / 三十秒**、同一マシンで測定しています。
5050

51-
**環境**
51+
**環境**
5252
Ubuntu 二十四点〇四 — Intel Xeon — C++20 最適化ビルド — ログ無効
5353

5454
結果は `"OK"` を返すシンプルなエンドポイントでの **定常状態スループット**です。
@@ -68,8 +68,8 @@ Ubuntu 二十四点〇四 — Intel Xeon — C++20 最適化ビルド — ログ
6868
| Crow(C++) | 一千百四十九 | 四一・六〇 ms | 〇・三五 MB/s |
6969
| FastAPI(Python) | 七百五十二 | 六三・七一 ms | 〇・一一 MB/s |
7070

71-
> 🔥 **新記録**
72-
> 単一コアに固定(`taskset -c 2`)した場合、
71+
> 🔥 **新記録**
72+
> 単一コアに固定(`taskset -c 2`)した場合、
7373
> **約 九万九千 req/s** に到達し、Go を上回り、最速クラスの C++ マイクロフレームワークに並びました。
7474
7575
---
@@ -174,25 +174,31 @@ using namespace vix;
174174

175175
int main()
176176
{
177-
auto bundle = vix::make_http_and_ws("config/config.json");
178-
auto &[app, ws] = bundle;
179-
180-
app.get("/", [](const Request &, Response &res)
181-
{ res.json({"framework", "Vix.cpp",
182-
"message", "HTTP + WebSocket example (basic) 🚀"}); });
183-
184-
ws.on_open([&ws](auto &session)
185-
{
186-
(void)session;
187-
188-
ws.broadcast_json("chat.system", {
189-
"user", "server",
190-
"text", "Welcome to Vix WebSocket! 👋"
191-
}); });
192-
193-
vix::run_http_and_ws(app, ws, 8080);
194-
195-
return 0;
177+
// Use default config path "config/config.json" and port 8080
178+
vix::serve_http_and_ws([](auto &app, auto &ws)
179+
{
180+
// Minimal HTTP route
181+
app.get("/", [](auto&, auto& res) {
182+
res.json({
183+
"message", "Hello from Vix.cpp minimal example 👋",
184+
"framework", "Vix.cpp"
185+
});
186+
});
187+
188+
// Minimal WebSocket handler: log and echo chat.message
189+
ws.on_typed_message(
190+
[&ws](auto& session,
191+
const std::string& type,
192+
const vix::json::kvs& payload)
193+
{
194+
(void)session;
195+
196+
if (type == "chat.message") {
197+
ws.broadcast_json("chat.message", payload);
198+
}
199+
}); });
200+
201+
return 0;
196202
}
197203
```
198204

@@ -249,10 +255,7 @@ app.get("/search", [](Request req, Response res) {
249255

250256
```cpp
251257
app.get("/missing", [](Request req, Response res) {
252-
return std::pair{
253-
404,
254-
json::o("error", "Not found")
255-
};
258+
res.status(404).json({"error", "Not found"});
256259
});
257260
```
258261

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,13 @@ Vix handles compilation, linking, and execution automatically.
140140

141141
- 📘 Docs: https://vixcpp.com/docs
142142
- 🌍 Website: https://vixcpp.com
143-
- 📦 Examples: https://github.com/vixcpp/vix/tree/main/examples
143+
- 📦 Examples: https://vixcpp.com/docs/examples
144144
---
145145

146146
## Contributing
147147

148148
Contributions are welcome.
149-
150149
If you care about modern C++, performance, and real-world reliability, you’ll feel at home here.
151-
152150
Please read the contributing guide before opening a PR.
153151

154152
---

examples/http_ws/main_basic.cpp

Lines changed: 23 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -19,53 +19,29 @@ using namespace vix;
1919

2020
int main()
2121
{
22-
// Construct the HTTP App + WebSocket Server together
23-
// The config file path can be omitted; if omitted,
24-
// Vix will automatically look for config/config.json.
25-
//
26-
auto bundle = vix::make_http_and_ws("config/config.json");
27-
auto &[app, ws] = bundle;
28-
29-
// GET /
30-
app.get("/", [](Request &, Response &res)
31-
{ res.json({"framework", "Vix.cpp",
32-
"message", "HTTP + WebSocket example (basic) 🚀"}); });
33-
34-
// GET /hello/{name}
35-
app.get("/hello/{name}", [](Request &req, Response &res)
36-
{ res.json({"greeting", "Hello " + req.param("name") + " 👋",
37-
"powered_by", "Vix.cpp"}); });
38-
39-
// Register WebSocket event handlers
40-
ws.on_open([&ws](auto &session)
41-
{
42-
(void)session;
43-
44-
ws.broadcast_json("chat.system", {
45-
"user", "server",
46-
"text", "Welcome to Vix WebSocket! 👋"
47-
}); });
48-
49-
// When a typed message is received:
50-
ws.on_typed_message(
51-
[&ws](auto &session,
52-
const std::string &type,
53-
const vix::json::kvs &payload)
54-
{
55-
(void)session;
56-
57-
// Basic chat echo example
58-
if (type == "chat.message") {
59-
ws.broadcast_json("chat.message", payload);
60-
} });
61-
62-
// 4) Start HTTP + WebSocket together
63-
// This function:
64-
// - runs the WebSocket server in a background thread
65-
// - installs a shutdown callback on the HTTP server
66-
// - blocks on app.run(port)
67-
//
68-
vix::run_http_and_ws(app, ws, 8080);
22+
// Use default config path "config/config.json" and port 8080
23+
vix::serve_http_and_ws([](auto &app, auto &ws)
24+
{
25+
// Minimal HTTP route
26+
app.get("/", [](auto&, auto& res) {
27+
res.json({
28+
"message", "Hello from Vix.cpp minimal example 👋",
29+
"framework", "Vix.cpp"
30+
});
31+
});
32+
33+
// Minimal WebSocket handler: log and echo chat.message
34+
ws.on_typed_message(
35+
[&ws](auto& session,
36+
const std::string& type,
37+
const vix::json::kvs& payload)
38+
{
39+
(void)session;
40+
41+
if (type == "chat.message") {
42+
ws.broadcast_json("chat.message", payload);
43+
}
44+
}); });
6945

7046
return 0;
7147
}

0 commit comments

Comments
 (0)