Files
marqdo/ext/net/websocket.mq.md
T
cflmyandCursor 687c168014 feat(parse): use nested YAML import: maps instead of one-liner binds
Frontmatter imports are now valid YAML (`import:` / `导入:` with bind→target
entries), removing spaced keys. Add `marqdo migrate imports`, hard-error the
old one-liner form, and migrate lib/ext/examples/tests/docs accordingly.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-23 19:33:58 +08:00

44 lines
943 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.
---
markup: occlusion
title: ext/net/websocket
description: WebSocket client Resource (ADR 0007).
import:
plugin: lib/plugin.mq.md
sys: lib/sys.mq.md
table: lib/table.mq.md
---
## _load
**p = > plugin.native_path name="web"**
1. `p`
> plugin.load path=`p`
2. *
> print text=ext/net: native web plugin not found
> sys.exit code=1
****
# ws
+ `timeout_sec`=30
WebSocket client helper.
> _load
`out` =
| timeout_sec | _type |
|-------------|-------|
| `timeout_sec` | ws |
*out*
## connect
+ `url`
+ `message`=""
+ `headers`=None
Single request–response: connect to `url`, send `message`, collect up to 256 server text replies (each up to 1 MiB), close. Transport errors and timeouts return `{ok:false, error}` instead of looking like an empty successful reply.
**timeout = [timeout_sec](access(self, "timeout_sec"))**
*> web_ws_connect url=`url` message=`message` headers=`headers` timeout_sec=`timeout`*