meiseayoung
a57ce2e77a
chore: update v.mod version
2026-01-06 12:01:45 +08:00
meiseayoung
0969901481
chore: update v.mod version
2026-01-05 11:50:46 +08:00
meiseayoung
26ac804b1d
chore: update v.mod version
2026-01-05 11:07:41 +08:00
meiseayoung
d31492fd59
chore: update v.mod version
2026-01-04 18:12:21 +08:00
meiseayoung
f7e753969d
fix: change the usockets/lib path
2026-01-04 15:44:54 +08:00
meiseayoung
9ae9170bcb
feat: add SSE streaming helper support
...
Add Server-Sent Events (SSE) and streaming response support with three
streaming functions:
- stream(): Basic binary streaming with chunked transfer encoding
- stream_text(): Text streaming with proper Content-Type headers
- stream_sse(): SSE event streaming with full event field support
Features:
- SSEEvent struct with data, event, id, retry fields
- StreamContext for write, writeln, write_sse, sleep, pipe operations
- Multi-line data handling in SSE events
- Custom error handler support
- Client disconnect detection via on_abort callback
- Integrated with both Picoev and uSockets backends
New files:
- streaming.v: Core streaming implementation
- examples/sse_demo.v: Comprehensive SSE demo with test page
- tests/test_stream_*.v: 62 property-based tests
Updated:
- picoev_server.v: PicoevStreamWriter integration
- usockets_server.v: UsocketsStreamWriter integration
- README.md: SSE streaming documentation
2026-01-04 15:13:28 +08:00
meiseayoung
6ab6d3b99e
feat(websocket): add WebSocket Helper with RFC 6455 compliance
...
Add comprehensive WebSocket support for v-hono framework, inspired by Hono.js WebSocket Helper.
Features:
- upgrade_websocket() function for WebSocket route handlers
- Event-based callbacks: on_open, on_message, on_close, on_error
- WSContext with send(), send_bytes(), send_json(), close() methods
- Connection state tracking (connecting, open, closing, closed)
- Configurable options: ping_interval, max_message_size, timeout, protocols
- Subprotocol negotiation support
- Ping/pong keep-alive handling
- Message size validation with 1009 close code
- Integration with picoev and uSockets backends
Protocol Compliance:
- RFC 6455 compliant handshake with Sec-WebSocket-Accept computation
- Frame encoding/decoding with proper masking
- Close handshake with status codes and reasons
- Text and binary message frame support
Testing:
- 13 property-based test files with 82 tests total
- Validates handshake, frame encoding, masking, JSON round-trip
- Tests context preservation, route patterns, connection state
- All existing tests pass (no regressions)
Files added:
- websocket.v: Core WebSocket implementation
- examples/websocket_demo.v: Chat room example
- examples/websocket_test.html: Browser test client
- tests/test_websocket_*.v: Property-based tests
Files modified:
- app.v: Add ws() method for WebSocket routes
- middleware.v: Export WebSocket types and functions
- picoev_server.v: WebSocket upgrade detection
- usockets_server.v: WebSocket upgrade detection
- README.md: WebSocket documentation
2026-01-04 13:38:12 +08:00
meiseayoung
4e2c6a90c3
feat: add 7 built-in middleware components inspired by Hono.js
...
New Middleware:
- CORS: Cross-Origin Resource Sharing with full configuration support
- Cookie Helper: Cookie management with signed cookie support (HMAC-SHA256)
- JWT: JSON Web Token authentication (HS256/384/512)
- Bearer Auth: Simple Bearer token authentication
- Compression: Gzip and deflate response compression
- Rate Limiting: Request rate limiting with customizable stores
- Validator: Schema-based request validation
Features:
- Context store for middleware data sharing (get/set/get_client_ip)
- Middleware export module with utility functions
- Comprehensive property-based tests for all middleware
- Example file demonstrating all middleware usage
Files Added:
- cors.v, cookie.v, jwt.v, bearer_auth.v, compress.v, rate_limit.v, validator.v
- middleware.v (unified exports)
- examples/middleware_demo.v
- tests/test_*.v (9 new test files)
Documentation:
- Updated README.md with detailed middleware usage guide
- Added Schema Builder API documentation
2026-01-04 11:11:15 +08:00
meiseayoung
44ba82c194
chore: update v.mod version
2026-01-03 20:50:24 +08:00
meiseayoung
43aae4f10d
chore: update v.mod version
2026-01-02 21:51:01 +08:00
meiseayoung
9aefe5714d
chore: update v.mod version
2025-12-31 18:35:29 +08:00
meiseayoung
b478269d8e
chore: update v.mod version
2025-12-31 17:38:29 +08:00
meiseayoung
0937dd268c
chore: update v.mod version
2025-12-31 15:46:10 +08:00
meiseayoung
5375b7394f
chore: update v.mod version
2025-12-30 21:40:39 +08:00
meiseayoung
8e1007a1b4
chore: update v.mod version
2025-12-30 18:42:02 +08:00
meiseayoung
418ead392b
chore: update v.mod version
2025-12-30 18:29:52 +08:00
meiseayoung
e22f612f24
chore: update v.mod version
2025-12-30 17:32:05 +08:00
meiseayoung
ee2818782b
chore: update v.mod version
2025-12-30 14:27:57 +08:00
meiseayoung
782a4e7795
refc: Refactor project structure
2025-12-30 11:00:46 +08:00
meiseayoung
1f8e9ac11e
Update v.mod
2025-07-11 11:24:14 +08:00
yangshangbo
2e859cbe99
fix: remove outer .v module
2025-07-11 10:08:09 +08:00
yangshangbo
d59c268492
feat: add chunk file upload
2025-07-10 10:03:57 +08:00
yangshangbo
763b2e62b5
feat: add HybridRouter add LRUCache
2025-07-04 14:49:00 +08:00
yangshangbo
8b18de9693
first commit
2025-04-10 18:14:01 +08:00