Fiber WSS Configuration Manual#1282
Fiber WSS Configuration Manual#1282jiangxianliang007 wants to merge 2 commits intonervosnetwork:developfrom
Conversation
Fiber WSS Configuration Manual
chenyukang
left a comment
There was a problem hiding this comment.
Reviewed the WSS configuration guide. I left a few inline comments around the parts that could mislead users when they try to connect from WASM/browser environments.
| "jsonrpc": "2.0", | ||
| "method": "node_info", | ||
| "params": [] | ||
| }' |jq '.result.addresses[0]' |awk -F '/p2p/' '{print $2}' |
There was a problem hiding this comment.
This should use jq -r; otherwise the extracted peer id can include the JSON quotes. It also assumes addresses[0] is the right /p2p/ address. A safer version would filter for an address containing /p2p/, for example:
jq -r '.result.addresses[] | select(contains("/p2p/")) | split("/p2p/")[1]'|
|
||
| Prerequisites: | ||
|
|
||
| - Fiber node config.yml announced_addrs add public IP |
There was a problem hiding this comment.
For browser/WASM clients, adding only a public TCP/IP address is not enough if the client resolves peers from graph data. The node should advertise a browser-usable WSS multiaddr, e.g. /dns4/fiber.example.com/tcp/443/wss, or this section should make clear that the WSS address is only for explicit connect_peer(address=...) usage.
| ssl_protocols TLSv1.2 TLSv1.3; | ||
|
|
||
| location / { | ||
| proxy_pass http://127.0.0.1:8228; |
There was a problem hiding this comment.
This proxy target relies on Fiber accepting WebSocket traffic on the P2P port. Since that depends on fiber.reuse_port_for_websocket staying enabled, the guide should mention that requirement near the prerequisites or this proxy example.
There was a problem hiding this comment.
Fiber listens for WebSocket connections on the same TCP port as P2P by default, The rest has been updated, and a pubkey connect_peer has been added.
| ``` | ||
|
|
||
| ## Connect via the WSS address | ||
| /dns4/{Your-Domain-Name}/tcp/443/wss/p2p/{Your-Fiber-Node-Addresses} |
There was a problem hiding this comment.
This gives the final multiaddr, but it would be more actionable to show how to use it, for example with connect_peer using the address parameter. If the intended flow is pubkey-based connection, please also mention addr_type: "wss" and the need for graph data to contain a WSS address.
Add pubkey connect
This PR demonstrates how to connect a Fiber node via WASM.