Skip to content

Fiber WSS Configuration Manual#1282

Open
jiangxianliang007 wants to merge 2 commits intonervosnetwork:developfrom
jiangxianliang007:configure-wss-
Open

Fiber WSS Configuration Manual#1282
jiangxianliang007 wants to merge 2 commits intonervosnetwork:developfrom
jiangxianliang007:configure-wss-

Conversation

@jiangxianliang007
Copy link
Copy Markdown

This PR demonstrates how to connect a Fiber node via WASM.

Fiber WSS Configuration Manual
Copy link
Copy Markdown
Collaborator

@chenyukang chenyukang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/fiber-node-wss.md Outdated
"jsonrpc": "2.0",
"method": "node_info",
"params": []
}' |jq '.result.addresses[0]' |awk -F '/p2p/' '{print $2}'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]'

Comment thread docs/fiber-node-wss.md Outdated

Prerequisites:

- Fiber node config.yml announced_addrs add public IP
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/fiber-node-wss.md
ssl_protocols TLSv1.2 TLSv1.3;

location / {
proxy_pass http://127.0.0.1:8228;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/fiber-node-wss.md Outdated
```

## Connect via the WSS address
/dns4/{Your-Domain-Name}/tcp/443/wss/p2p/{Your-Fiber-Node-Addresses}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants