Release 2.7.0: executable handbooks and native user-site workflows
This commit is contained in:
1 parent
aa0c4d0f55
commit
d9aef957f7
562 files changed
+21064
-20387
No files matched your search
+19
-1
@@ -7,7 +7,7 @@ import:
|
||||
sys: lib/sys.mq.md
|
||||
---
|
||||
|
||||
This file constructs the application Result record only; it does not implement an HTTP transport. For real HTTP requests, response limits and downloads, import lib/net.mq.md. The [network entry](index.mq.md) distinguishes pure URL transformations from native WebSocket exchanges. Keep these responsibilities explicit when extending the package so a readable tool name never implies a missing capability.
|
||||
This file constructs application Result records and binds explicit server redirects; it does not implement an HTTP client. For real HTTP requests, response limits and downloads, import lib/net.mq.md. The [network entry](index.mq.md) distinguishes pure URL transformations from native WebSocket exchanges. Keep these responsibilities explicit when extending the package so a readable tool name never implies a missing capability.
|
||||
|
||||
## _load
|
||||
|
||||
@@ -48,3 +48,21 @@ Unified Result map `{ok, value, error}`.
|
||||
| `ok` | `value` | `error` |
|
||||
|
||||
Return *out*.
|
||||
|
||||
## redirect
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| app | any | required | Prepared web application |
|
||||
| from | text | required | Explicit source route |
|
||||
| to | text | required | Redirect destination |
|
||||
| permanent | bool | False | False uses a temporary redirect; True uses the native permanent status |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Updated app with the declared server redirect |
|
||||
|
||||
Use `app`, `from`, `to` and `permanent`=False before web.listen. This is a server route policy owned by the network resource, not a client-side history operation. Keep the returned app because binding produces a new value. Redirecting a legacy entry path can coexist with Document and Endpoint discovery without rebuilding the application through removed configure methods. The native runtime validates declared source paths. No listener starts here, and constructing a redirect does not verify that its destination page exists.
|
||||
|
||||
We **[Load the existing native HTTP runtime](_load())**.
|
||||
Return *[Bind this declared HTTP redirect](web_app_redirect(app=`app`, from=`from`, to=`to`, permanent=`permanent`))*.
|
||||
@@ -10,6 +10,7 @@ This package provides [URL encoding](url.mq.md), the small [HTTP result construc
|
||||
and a native [WebSocket request/response resource](websocket.mq.md). For HTTP clients with
|
||||
status, timeout, response limits and downloads, read the standard library net.mq.md directly.
|
||||
The HTTP leaf here constructs a result record; its name does not imply an implemented HTTP client.
|
||||
绑定服务端运输使用 websocket.route;中文入口是[实时绑定](实时.mq.md),它与一次客户端 exchange 的生命周期不同。
|
||||
|
||||
URL encoding is pure and needs no plugin. This command is ready to run from the repository root:
|
||||
|
||||
|
||||
@@ -26,6 +26,28 @@ We retain **`p` = [Locate the installed native plugin](plugin.native_path(name="
|
||||
We **[End this run with the selected exit status](sys.exit(code=1))**.
|
||||
Return *None*.
|
||||
|
||||
## route
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| app | any | required | Prepared application returned by web.prepare |
|
||||
| path | text | required | Declared WebSocket path, including optional path captures |
|
||||
| mode | text | "echo" | echo, drain, broadcast or room |
|
||||
| room_key | text | "" | Room template required by room mode |
|
||||
| presence | bool | False | Publish native room presence messages |
|
||||
| require_auth | any | None | None keeps private broadcast/room defaults; False explicitly opens a local demo |
|
||||
| on_message | text | "" | Optional declared Marqdo callback member |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| result | map | Updated app with this explicitly declared WebSocket route |
|
||||
|
||||
Use `app`, `path`, `mode`="echo", `room_key`="", `presence`=False, `require_auth`=None and `on_message`="" to bind a server transport before web.listen. This function belongs to the network resource; it does not change Document layout or start a socket. Retain the returned app because native resource updates produce a new value. Room mode requires a room_key template; captures such as {id} select the room at request time. Broadcast and room routes require login unless the caller explicitly opts out. Public local demos should say why require_auth=False is intentional. Presence and callbacks retain the native transport's bounded message handling; they are not a client subscription object.
|
||||
|
||||
We **[Load the native transport implementation](_load())**.
|
||||
Return *[Register this declared WebSocket transport](web_app_route_ws(app=`app`, path=`path`, echo=None, mode=`mode`, room_key=`room_key`, on_message=`on_message`, presence=`presence`, require_auth=`require_auth`))*.
|
||||
|
||||
|
||||
# ws
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
markup: occlusion
|
||||
title: 服务端 WebSocket 实时资源
|
||||
import:
|
||||
socket: ext/net/websocket.mq.md
|
||||
---
|
||||
|
||||
本文件提供 websocket.mq.md 的路由绑定中文入口。客户端持续连接由浏览器标准库负责,服务器只在准备好的应用上声明运输资源。独立的一次连接/响应测试仍使用英文文件的 ws 与 connect,不把两种生命周期混为一谈。
|
||||
|
||||
## 绑定
|
||||
|
||||
| 参数 | 类型 | 默认 | 说明 |
|
||||
|---|---|---|---|
|
||||
| 应用 | any | 必填 | 准备站点返回并保留其他资源的应用 |
|
||||
| 路径 | text | 必填 | 明确声明的套接字路径,可含路径捕获 |
|
||||
| 模式 | text | "echo" | echo、drain、broadcast 或 room |
|
||||
| 房间键 | text | "" | room 模式的房间模板,例如文档路径捕获 |
|
||||
| 在线通知 | bool | False | 是否发布原生在线人数消息 |
|
||||
| 需要登录 | any | None | None 保留广播/房间私有默认;False 明确公开 |
|
||||
| 消息回调 | text | "" | 可选已声明 Marqdo 回调成员 |
|
||||
|
||||
| 返回 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| 结果 | map | 附加明确 WebSocket 路由的新应用,尚未监听 |
|
||||
|
||||
使用`应用`、`路径`、`模式`="echo"、`房间键`=""、`在线通知`=False、`需要登录`=None、`消息回调`=""。授权 plugin,在监听前保留返回的新应用。构造不会连接浏览器、修改 Document 布局或创建后台线程。
|
||||
|
||||
room 模式需要房间键,模板在实际请求中代入路径捕获。广播与房间默认要求登录;本地回显示例显式 False,只用于回环地址的公开演示。隐藏导航不能保护连接,身份策略仍由服务器执行。回调与消息上限沿用原生运输,连接错误不能当作空的成功回复。
|
||||
|
||||
绑定完成后返回 *[登记同一个应用的实时运输资源](socket.route(app=`应用`, path=`路径`, mode=`模式`, room_key=`房间键`, presence=`在线通知`, require_auth=`需要登录`, on_message=`消息回调`))*。
|
||||
Reference in new issue
Block a user