Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add heartbeats to WebSockets #211

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions 17.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,32 @@ Wallet:
}
```

## Heartbeats

Because some WebSocket implementations do not support native heartbeat control frames (many browser clients), this protocol defines it's own heartbeat mechanism. Wallets are expected to send a heartbeat-request at least every 30 seconds. Mints are expected to return a heartbeat-response (if there are multiple queued, responding to the latest one is sufficient).

Note: As wallets are expected to send a heartbeat at least every 30 seconds, mints can assume connections that have been idling for at least 45 seconds to be stale and close the connection.

### Heartbeat request

```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "heartbeat"
}
```

### Heartbeat response

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": "heartbeat"
}
```

## Mint info setting

Mints signal websocket support via [NUT-06][06] using the following setting:
Expand Down
Loading