Class: Nostr::Relay

Inherits:
Object
  • Object
show all
Defined in:
lib/nostr/relay.rb

Overview

Relays expose a websocket endpoint to which clients can connect.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url:, name:) ⇒ String

Instantiates a new Relay

Examples:

relay = Nostr::Relay.new(url: 'wss://relay.damus.io', name: 'Damus')


38
39
40
41
# File 'lib/nostr/relay.rb', line 38

def initialize(url:, name:)
  @url = url
  @name = name
end

Instance Attribute Details

#nameString (readonly)

The name of the relay

Examples:

relay.name # => 'Damus'

Returns:

  • (String)


26
27
28
# File 'lib/nostr/relay.rb', line 26

def name
  @name
end

#urlString (readonly)

The websocket URL of the relay

Examples:

relay.url # => 'wss://relay.damus.io'

Returns:

  • (String)


15
16
17
# File 'lib/nostr/relay.rb', line 15

def url
  @url
end