<p>Hi <a href="/r/golang" rel="nofollow">r/golang</a>,</p>
<p>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.</p>
<p>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.</p>
<p>Cheers</p>
<hr/>**评论:**<br/><br/>StoneJolt: <pre><p>maybe something like <a href="http://www.grpc.io/" rel="nofollow">http://www.grpc.io/</a></p></pre>peterbourgon: <pre><p>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.</p></pre>ChristophBerger: <pre><p>Valid point - go with the stdlib as far as you can. </p>
<p>Still, I am curious... is your point specifically about <em>frameworks</em> (I understand it this way), or rather about <em>any</em> 3rd-party lib/framework/whatever that should not rely on any other 3rd-party lib/framework/whatever? </p></pre>Shaqalac: <pre><p>That is indeed a very good point!</p></pre>Frakturfreund: <pre><p>Annother option is Google’s <a href="http://www.grpc.io/" rel="nofollow">gRPC</a>, which uses Protocol Buffers for data exchange. It has a <a href="http://www.grpc.io/docs/quickstart/go.html" rel="nofollow">Go Quickstart</a> tutorial.</p></pre>natefinch: <pre><p>If you're new to Go, I suggest just using the std lib's net/rpc</p>
<p>There's no real reason to use anything more complicated.</p></pre>kfirufk: <pre><p>What about a message broker like nats.io? It's written in go.</p></pre>picklednull: <pre><p><a href="http://zeromq.org/" rel="nofollow">zeromq</a>. There are <a href="https://github.com/zeromq/goczmq" rel="nofollow">bindings for Go</a>.</p></pre>qu33ksilver: <pre><p>ZeroMQ is a great library for distributed network programming. Use this - <a href="https://github.com/pebbe/zmq4" rel="nofollow">https://github.com/pebbe/zmq4</a>. The latest v4 comes in ECC built in to the protocol.</p></pre>ChristophBerger: <pre><p>Have a look at <a href="https://awesome-go.com/#networking" rel="nofollow">Awesome Go</a> - but keep in mind that the stdlib already provides quite a lot - <code>net</code>, <code>encoding/gob</code>, <code>net/http</code>, <code>net/websocket</code>,... (as others have already pointed out here).</p>
<p>There are also quite some libs and frameworks available for distributed programming, like micro, go-kit, and <a href="https://awesome-go.com/#distributed-systems" rel="nofollow">others</a>, so you might not even have to create your own.</p></pre>itsamemmario: <pre><p>You'd be suprised how well developped the standard library is.
That being said,
<a href="https://godoc.org/golang.org/x/net/websocket" rel="nofollow">https://godoc.org/golang.org/x/net/websocket</a>
or
<a href="https://godoc.org/github.com/gorilla/websocket" rel="nofollow">https://godoc.org/github.com/gorilla/websocket</a></p></pre>shark1337: <pre><p>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.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传