Sobes.tech
Junior — Middle

What protocols have you used for data transfer in your last project?

sobes.tech AI

Answer from AI

In my last project with Go, I used the following protocols for data transfer:

  • HTTP/HTTPS — for REST API interactions between services.
  • gRPC — for high-performance communication between microservices using the HTTP/2 protocol and Protocol Buffers (protobuf).
  • WebSocket — for bidirectional real-time data transfer, for example, for UI updates.

Example of using an HTTP client in Go:

resp, err := http.Get("https://api.example.com/data")
if err != nil {
    log.Fatal(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))