在Go中使用HTTP与使用TCP套接字将文件下载/上传到服务器有什么优势? [关闭]

I am setting up multiple servers for a social networking app and have never worked with HTTP before. Is there advantages of using HTTP instead of creating your own protocol for TCP streams? It will be used for both normal text transfer and images/videos.

I have started up a general TCP server that can transfer both small organized text packets and also larger image/video streams but I'm unsure if it will be as scalable/efficient/secure as using HTTP/s. I'm not going to post the code as I hope this question is general enough to not require it and I am not looking for code analysis quite yet.

The server is working for transferring data but I am not sure of the advantages/disadvantages of using HTTP instead. Do other websites that use Go for their system use HTTP or just straight sockets?

Raw TCP sockets are theoretically more performant (ignoring several external factors) than HTTP.

HTTP libraries are robust and well tested, and constantly updated in the face of new bugs and security threats.

So do you optimize for raw performance, or for developer time?

A few questions to ask yourself:

  1. Is HTTP too slow for my application? (Related question: Have I measured it?)
  2. Do I have the time and energy to respond to bugs and vulnerabilities in my connectivity library for the life of my program?
  3. If I am wildly successful, can I find, hire, train and retain a qualified workforce?

If this is just for your learning, go for it.