In example/obsserver/obsserver.go, line 42-45:
if value, ok := m.Option(coap.Observe).([]uint8); ok &&
len(value) >= 1 && value[0] == 1 {
go periodicTransmitter(l, a, m)
}
The type assertion gives a false for okay and a wrong value. This causes the if-clause to fail, and so the function periodicTransmitter is never called. I changed the code like this to get it to work:
obss := fmt.Sprint(m.Option(coap.Observe))
value, err := strconv.Atoi(obss)
if err != nil {
log.Fatalf("Could not convert observe value to int", err)
}
if value == 1 {
go periodicTransmitter(l, a, m)
}
with imports of fmt and strconv.