Track Workers by uuid for Reconnection
This commit is contained in:
parent
9ac9ed8fe2
commit
d0f220fd0a
6 changed files with 64 additions and 9 deletions
|
@ -10,15 +10,15 @@ import (
|
|||
"git.lastassault.de/speatzle/morffix/config"
|
||||
"git.lastassault.de/speatzle/morffix/constants"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"nhooyr.io/websocket"
|
||||
)
|
||||
|
||||
func Start(conf config.Config) {
|
||||
ctx := context.Background()
|
||||
headers := http.Header{}
|
||||
|
||||
uuid := uuid.New()
|
||||
slog.InfoContext(ctx, "Connecting to Server...", "Address", conf.Worker.Address)
|
||||
headers.Add(constants.SHARED_SECRET_HEADER, conf.SharedSecret)
|
||||
headers.Add(constants.UUID_HEADER, uuid.String())
|
||||
c, res, err := websocket.Dial(ctx, conf.Worker.Address, &websocket.DialOptions{
|
||||
HTTPHeader: headers,
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue