Best option for web client/server communication

polaris · · 548 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I&#39;m writing a program with a go back end that talks to a web front-end and was curious about my options for communication between the two. The front end was started in JavaScript and websockets, but I really don&#39;t like working with JavaScript, so switched to Gopherjs with websocketjs but was having tons of issues with implementation. </p> <p>What other options do I have with gopherJS to communicate between server and client? I would prefer something as simple as websockets to implement.</p> <hr/>**评论:**<br/><br/>scottjbarr: <pre><p>If you&#39;re building something to run in the browser, JS is really your best bet. GopherJS, while interesting, is going to have some issues. My brief play around with it produced massive, unreadable JS files. Kind of reminded me of CoffeeScript all over again.</p> <p>You can basically Google your way through building a JS app. You might have a harder time doing that with GopherJS.</p> <p>I&#39;m not being mean to GopherJS here. I&#39;m sure it suits some people just fine. I find using the <em>right</em> tool for the job at hand is easier. As much as I really love Go, using it to generate the right bit of JS just seems like hard work.</p></pre>niosop: <pre><p>Could try elm and websockets if you wanna dip into FP.</p></pre>mofirouz: <pre><p>What exactly are you trying to achieve? What&#39;s the purpose of the website and the back end for it?</p></pre>deranjer: <pre><p>It is a torrent downloader with a single page webui frontend. The back end sends an update on progress every few seconds and also handles user input from the frontend.</p></pre>LadyDascalie: <pre><blockquote> <p>I would prefer something as simple as websockets to implement.</p> </blockquote> <p>Then... Implement websockets? It&#39;s literally as easy as websockets. And it does fit your use case of updating every so often.</p> <p>I know it&#39;s a crappy answer, but to be honest, Javascript just is the most direct answer here.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

548 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传