tangled
alpha
login
or
join now
stream.place
/
streamplace
74
fork
atom
Live video on the AT Protocol
74
fork
atom
overview
issues
1
pulls
pipelines
Add shut down after 5s to the example.
Ruediger Klaehn
5 months ago
fc022926
165f4cda
+10
1 changed file
expand all
collapse all
unified
split
pkg
iroh
iroh_test
main.go
+10
pkg/iroh/iroh_test/main.go
···
4
4
"crypto/rand"
5
5
"fmt"
6
6
"os"
7
7
+
"time"
7
8
8
9
iroh "stream.place/streamplace/pkg/iroh/generated/iroh_streamplace"
9
10
_ "stream.place/streamplace/pkg/streamplacedeps"
···
69
70
panicIfErr(err)
70
71
fmt.Printf("Iter items: %+v\n", items3)
71
72
73
73
+
go func() {
74
74
+
time.Sleep(5 * time.Second)
75
75
+
node.Shutdown() // or whatever your shutdown method is
76
76
+
}()
77
77
+
72
78
sub := db.Subscribe(iroh.NewFilter())
73
79
for {
74
80
ev, err := sub.NextRaw()
75
81
panicIfErr(err)
82
82
+
if ev == nil {
83
83
+
fmt.Println("Subscription closed")
84
84
+
break
85
85
+
}
76
86
switch (*ev).(type) {
77
87
case iroh.SubscribeItemEntry:
78
88
fmt.Printf("%+v\n", (*ev).(iroh.SubscribeItemEntry))