Junior — Middle
Milliseid protokolle te kasutasite andmete edastamiseks oma viimases projektis?
sobes.tech AI
Vastus AI-lt
In the last Go project, I used the following protocols for data transmission:
- HTTP/HTTPS — for REST API interaction between services.
- gRPC — for high-performance communication between microservices using HTTP/2 and protobuf protocols.
- WebSocket — for bidirectional data transfer in real-time, 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))