NATS Server in Go application

I have a Go backend hosted on fly. The backend has been tested both as a fly app and as a docker container; both work well!

I now want a pub/sub NATS implementation to it. I would initially like to host the NATS server using the Go NATS server library, and if it scales I would move it so some separate cluster.

The idea of my application is having many publishers that send to a topic /device/* and the backend would subscribe to all of those (device/*).

I did a quick test and something in the http layer was not correct, so I got a immediate io.EOF as response. I think this was due to a handshake error. I believe the error could be fixed by allocating a ipv4 address, but this would bring me out of the complete free tier, so I am looking for a solution where I could maintain the free tier and have a NATS server.

I am currently running all free tier, would it be possible to implement the NATS cluster to my backend while maintaining the free usage?


the first thing that came to my mind, deploy another fly machine with the nats server and use the internal fly address to connect from your go app. Private Networking ยท Fly Docs. Does this work for you?

Kind regards

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.