class

LocalSend::Discovery

Inherits Reference < Object

Discovers LocalSend peers and announces this device.

Events are buffered, so a slow consumer never blocks network fibers.

Constants

ANNOUNCE_INTERVAL = 30.seconds
FORGET_AFTER = 5.minutes

Allow missed announcements before emitting Lost.

Log = LocalSend::Log.for("discovery")

Constructors

new(identity : Identity, port : Int32 = DEFAULT_PORT, interface : String | Nil = nil, broadcast : String | Nil = nil, buffer_size : Int32 = 64)
Source

Instance methods

events
Source
peers

Peers seen so far.

Source
register(info : Protocol::DeviceInfo, address : String) : Nil

Records a peer that registered over HTTP.

Source
run

Starts announcements and peer discovery until #stop.

Source
stop
Source
sweep(now : Time::Instant = Time.instant) : Nil

Removes peers unseen for FORGET_AFTER.

Source
wait_for(target : String, timeout : Time::Span) : Device | Nil

Waits for a matching alias or address until timeout expires.

Source

Nested types