Configure modular setup for different instructions
This commit is contained in:
parent
dc5be6627a
commit
812deb4bdc
16
main.go
16
main.go
|
@ -123,13 +123,21 @@ func awaitInstructions(conn net.Conn) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if inst.IsHeartbeat == true && inst.Message == "PING" {
|
|
||||||
resp := Response{
|
switch {
|
||||||
Message: "PONG",
|
///////////////////////////////
|
||||||
|
case inst.IsHeartbeat == true && inst.Message == "PING":
|
||||||
|
resp := Response{Message: "PONG"}
|
||||||
|
err := sendMessage(resp, conn)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
sendMessage(resp, conn)
|
|
||||||
return nil
|
return nil
|
||||||
|
///////////////////////////////
|
||||||
|
default:
|
||||||
|
sendMessage(Response{Message: "Unknown order!"}, conn)
|
||||||
}
|
}
|
||||||
|
///////////////////////////////
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue