GunDB Relay Server Class

This class creates and manages a GunDB relay server that can:

  • Serve as a peer for other GunDB instances
  • Store and relay data between connected peers
  • Provide persistence and caching
  • Handle authentication and encryption

Note: This class is primarily designed for Node.js environments. In browser environments, most functionality will be limited.

Constructors

  • Creates a new GunDB relay server instance

    Parameters

    • config: RelayConfig = {}

      Configuration options for the relay server

    Returns Relay

Properties

_isNodeEnvironment: boolean
config: RelayConfig
gun: IGunInstance<any>
log: (message: string, ...args: any[]) => void
server: any
status: RelayStatus

Methods

  • Gets the Gun instance

    Returns IGunInstance<any>

    Gun instance

  • Gets the relay URL

    Returns string

    Relay URL string

  • Gets the server instance

    Returns any

    Server instance

  • Checks if the relay is healthy

    Returns Promise<boolean>

    Promise that resolves to true if healthy

  • Initialize Gun instance asynchronously

    Returns Promise<void>

  • Checks if the relay is running in a Node.js environment

    Returns boolean

    True if running in Node.js

  • Starts the relay server

    Returns Promise<void>

    Promise that resolves when the server is started

  • Stops the relay server

    Returns Promise<void>

    Promise that resolves when the server is stopped

  • Updates the relay configuration

    Parameters

    • newConfig: Partial<RelayConfig>

      New configuration options

    Returns void