Setup RPC Server
This commit is contained in:
parent
496d5f412f
commit
cf000931e4
2 changed files with 15 additions and 5 deletions
|
@ -5,6 +5,9 @@ import (
|
|||
"io"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
|
||||
"git.lastassault.de/speatzle/morffix/rpc"
|
||||
|
||||
"os"
|
||||
"os/signal"
|
||||
"time"
|
||||
|
@ -18,6 +21,7 @@ import (
|
|||
)
|
||||
|
||||
var conf config.Config
|
||||
var rpcServer = rpc.NewServer()
|
||||
|
||||
func Start(_conf config.Config) {
|
||||
conf = _conf
|
||||
|
@ -69,10 +73,6 @@ func connectToServer(ctx context.Context, uuid uuid.UUID) {
|
|||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
time.Sleep(time.Second * 5)
|
||||
c.Write(ctx, websocket.MessageText, []byte("test"))
|
||||
}()
|
||||
|
||||
slog.InfoContext(ctx, "Waiting for Messages")
|
||||
for {
|
||||
|
@ -94,5 +94,6 @@ func readMessage(ctx context.Context, c *websocket.Conn) error {
|
|||
return err
|
||||
}
|
||||
slog.InfoContext(ctx, "Got Websocket Message", "type", t.String(), "data", data)
|
||||
rpcServer.HandleMessage(ctx, c, data)
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue