Skip to content

Commit 73fa495

Browse files
author
Jannis Pohlmann
committed
examples/simple-server: Implement a dummy UserFromAuthToken function
1 parent 31232c2 commit 73fa495

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

examples/simple-server/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ func main() {
3131

3232
// Create subscription manager and GraphQL WS handler
3333
subscriptionManager := graphqlws.NewSubscriptionManager(&schema)
34-
websocketHandler := graphqlws.NewHandler(subscriptionManager)
34+
websocketHandler := graphqlws.NewHandler(graphqlws.HandlerConfig{
35+
SubscriptionManager: subscriptionManager,
36+
UserFromAuthToken: func(token string) (interface{}, error) {
37+
return "Default user", nil
38+
},
39+
})
3540

3641
// Serve the GraphQL WS endpoint
3742
http.Handle("/subscriptions", websocketHandler)

0 commit comments

Comments
 (0)