heartbeat

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2023 License: MIT, MIT Imports: 7 Imported by: 5 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package heartbeat provides a service for sending heartbeats to a server.

Index

Constants

View Source
const SendInterval = 10 * time.Minute

SendInterval determines the delay between requests. This must be larger than the MinHeartbeatInterval in the server.

Variables

This section is empty.

Functions

func Beat

func Beat(
	ctx context.Context,
	log log.Logger,
	url string,
	payload *Payload,
) error

Beat sends a heartbeat to the server at the given URL. It will send a heartbeat immediately, and then every SendInterval. Beat spawns a goroutine that will send heartbeats until the context is canceled.

Types

type Payload

type Payload struct {
	Version string `json:"version"`
	Meta    string `json:"meta"`
	Moniker string `json:"moniker"`
	PeerID  string `json:"peerID"`
	ChainID uint64 `json:"chainID"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL