diff --git a/gql.go b/gql.go index 250c59b..aef74ca 100644 --- a/gql.go +++ b/gql.go @@ -310,7 +310,7 @@ func GQLWSHandler(schema graphql.Schema, ctx context.Context) func(http.Response for { // TODO: Make this a select between reading client data and getting updates from the event to push to clients" msg_raw, op, err := wsutil.ReadClientData(conn) - log.Logf("gqlws", "MSG: %s\nOP: 0x%02x\nERR: %+v\n", string(msg_raw), op, err) + log.Logf("gqlws_hb", "MSG: %s\nOP: 0x%02x\nERR: %+v\n", string(msg_raw), op, err) msg := GQLWSMsg{} json.Unmarshal(msg_raw, &msg) if err != nil { @@ -329,7 +329,7 @@ func GQLWSHandler(schema graphql.Schema, ctx context.Context) func(http.Response break } } else if msg.Type == "ping" { - log.Logf("gqlws", "PING FROM %s", r.RemoteAddr) + log.Logf("gqlws_hb", "PING FROM %s", r.RemoteAddr) err = wsutil.WriteServerMessage(conn, 1, []byte("{\"type\": \"pong\"}")) if err != nil { log.Logf("gqlws", "WS_SERVER_ERROR: FAILED TO SEND PONG") diff --git a/graph.go b/graph.go index 903a776..50b32b3 100644 --- a/graph.go +++ b/graph.go @@ -23,7 +23,7 @@ type DefaultLogger struct { } var log DefaultLogger = DefaultLogger{loggers: map[string]zerolog.Logger{}} -var all_components = []string{"update", "graph", "event", "resource", "manager", "test", "gql", "vex", "gqlws", "gqlws_new", "listeners"} +var all_components = []string{"update", "graph", "event", "resource", "manager", "test", "gql", "vex", "gqlws", "gqlws_new", "gqlws_hb", "listeners"} func (logger * DefaultLogger) Init(components []string) error { logger.init_lock.Lock() diff --git a/test-site/src/routes/+page.svelte b/test-site/src/routes/+page.svelte index 8f0eec4..c219f40 100644 --- a/test-site/src/routes/+page.svelte +++ b/test-site/src/routes/+page.svelte @@ -26,23 +26,25 @@ client.subscribe({ game_id = obj.Arenas[0].Owner.ID client.subscribe({ - query: "subscription($arena_id:String) { Arena(arena_id:$arena_id) { Owner { Name ... on Match { State Control StateStart StateDuration } } }}", + query: "subscription($arena_id:String) { Arena(arena_id:$arena_id) { Owner { ID Name ... on Match { State Control StateStart StateDuration } } }}", variables: { arena_id: arena_id }, }, - { - next: (data) => { - console.log("ARENA_SUB") - console.log(data) - }, - error: (err) => { - console.log("ARENA_SUB") - console.log(err) - }, - complete: () => { - }, -}); + { + next: (data) => { + console.log("ARENA_SUB") + let obj = JSON.parse(data.data) + console.log(obj.Arena) + game_id = obj.Arena.Owner.ID + }, + error: (err) => { + console.log("ARENA_SUB") + console.log(err) + }, + complete: () => { + }, + }); }, error: (err) => { console.log(err)