/** SEND REQUEST */ func (t *TcpMessageClient) sendRequest(request messages.Message) error { // Encode request encoded := messages.Encode(request) // Send request err := utils.Write(t.conn, encoded) if err != nil { fmt.Println("Error sending request:", err.Error()) return err } return nil }
func (t *TcpMessageHub) handleResponse(response messages.Response) error { // Encode response encoded := messages.Encode(response) // Send the responses for _, id := range response.GetReceiverIds() { err := utils.Write(t.conns[id], encoded) if err != nil { fmt.Println("Error sending response:", err.Error()) return err } } return nil }