Are there any examples which I can look at for what a correct implementation of a CoAP server running in fly.io over UDP would look like. I am particularly interested into knowing if there is some extra configuration I need to do other than what is suggested in the docs.
Example
Go to the Simple Example in this repo, and deploy the server to fly.io
then call with the client code the server, you should get the error:
Just to verify I also implemented the CoAP server over TCP (check commented code in this example) and the implementation just works.
I really think there is something wrong happening with the UDP service communication. I don’t know what internally your reverse proxy does but I will really appreciate some help
The client sends data over CoAP to the deployed instance in fly.io;
I can observe the logs from the dashboard and I see that the server gets the message, but then the client gets an error that it can’t write to the request; to me this seems as if the server can be reached but can’t acknowledge the messages and the client assumes the message was never responded to.
For fact I did verify that the implementation is correct and it works in a different environment (local network)
Server code
func handleMessage(w mux.ResponseWriter, r *mux.Message) {
fmt.Println("Hello world, I will try to write to connection", r.Message)
err := w.SetResponse(codes.POST, message.TextPlain, bytes.NewReader([]byte("hello world")))
if err != nil {
log.Printf("cannot set response: %v", err)
}
}
Logs
2024-05-28T15:25:33.873 app[7843d45b2d2598] ams [info] Hello world, I will try to write to connection Code: POST, Token: 58a904b98b6c4ddc, Path: /a, ContentFormat: text/plain; charset=utf-8, Type: Confirmable, MessageID: 21626, PayloadLen: 3
The “cannot set response error” log is not printed but on the client code