Hi r/golang,
I'm working on a project, making a framework for distributed programming. Obviously we need some communication between systems on a network. We've used a similar framework in Java, where it utilised socket programmering to communicate between nodes on a network.
I'm asking here as I'm fairly new to Golang and I don't want to waste too much time reinventing the plate if it's already out there in a nice library.
Cheers
评论:
StoneJolt:
peterbourgon:maybe something like http://www.grpc.io/
ChristophBerger:Absent more information, a framework for distributed programming should probably not rely on another framework for its network communication. Use the stdlib, net.Dial, and net.Listen.
Shaqalac:Valid point - go with the stdlib as far as you can.
Still, I am curious... is your point specifically about frameworks (I understand it this way), or rather about any 3rd-party lib/framework/whatever that should not rely on any other 3rd-party lib/framework/whatever?
Frakturfreund:That is indeed a very good point!
natefinch:Annother option is Google’s gRPC, which uses Protocol Buffers for data exchange. It has a Go Quickstart tutorial.
kfirufk:If you're new to Go, I suggest just using the std lib's net/rpc
There's no real reason to use anything more complicated.
picklednull:What about a message broker like nats.io? It's written in go.
qu33ksilver:zeromq. There are bindings for Go.
ChristophBerger:ZeroMQ is a great library for distributed network programming. Use this - https://github.com/pebbe/zmq4. The latest v4 comes in ECC built in to the protocol.
itsamemmario:Have a look at Awesome Go - but keep in mind that the stdlib already provides quite a lot -
net
,encoding/gob
,net/http
,net/websocket
,... (as others have already pointed out here).There are also quite some libs and frameworks available for distributed programming, like micro, go-kit, and others, so you might not even have to create your own.
shark1337:You'd be suprised how well developped the standard library is. That being said, https://godoc.org/golang.org/x/net/websocket or https://godoc.org/github.com/gorilla/websocket
I'd say net/http, but if you're not looking to support http2, you can use fasthttp library. There's a lot of web frameworks that implements the basic http package with some cool features, but I'm not sure if you're gonna need all of those stuffs. If you're gonna make it to be distributed, you'll see that after using a big framework (only id), you'll realize that it comes with a lot of useless stuffs that makes your binary larger. I'd go for net/http + http router, that's all I would use.
