lolly/docs/lua/websocket/README.md
xfy 6543422281 docs: 添加 Nginx 配置和 Lua 脚本示例文档
- config: 反向代理、缓存、负载均衡、安全、SSL 等配置模板
- lua: API 网关、认证、动态路由、限流、WebSocket 等脚本示例

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 17:59:22 +08:00

24 lines
614 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# WebSocket 示例
基于 Lua 沙箱的 WebSocket 连接处理示例,展示如何在 `lolly` 项目中实现 WebSocket 通信。
## 功能
- 连接验证Token 校验)
- 消息路由与处理框架
- 心跳保活
- 安全沙箱隔离
## 文件说明
| 文件 | 用途 |
|------|------|
| `nginx.conf` | Nginx + Lua 配置示例 |
| `ws_handler.lua` | WebSocket 消息处理逻辑 |
## 使用方式
1.`nginx.conf` 中的配置集成到你的 Nginx 配置中
2. 根据实际情况修改 `ws_handler.lua` 中的验证逻辑和消息处理
3. 确保 `content_by_lua_file` 指向正确的脚本路径