Skip to content

Commit eb0fdae

Browse files
committed
subscription: removed SubscriptableSchema
1 parent 44a2828 commit eb0fdae

File tree

1 file changed

+0
-35
lines changed

1 file changed

+0
-35
lines changed

subscription.go

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,41 +21,6 @@ type SubscribeParams struct {
2121
FieldSubscriber FieldResolveFn
2222
}
2323

24-
// SubscriptableSchema implements `graphql-transport-ws` `GraphQLService` interface: https://github.com/graph-gophers/graphql-transport-ws/blob/40c0484322990a129cac2f2d2763c3315230280c/graphqlws/internal/connection/connection.go#L53
25-
// you can pass `SubscriptableSchema` to `graphql-transport-ws` `NewHandlerFunc`
26-
type SubscriptableSchema struct {
27-
Schema Schema
28-
RootObject map[string]interface{}
29-
}
30-
31-
// Subscribe method let you use SubscriptableSchema with graphql-transport-ws https://github.com/graph-gophers/graphql-transport-ws
32-
func (self *SubscriptableSchema) Subscribe(ctx context.Context, queryString string, operationName string, variables map[string]interface{}) (<-chan interface{}, error) {
33-
c := Subscribe(Params{
34-
Schema: self.Schema,
35-
Context: ctx,
36-
OperationName: operationName,
37-
RequestString: queryString,
38-
RootObject: self.RootObject,
39-
VariableValues: variables,
40-
})
41-
to := make(chan interface{})
42-
go func() {
43-
defer close(to)
44-
for {
45-
select {
46-
case <-ctx.Done():
47-
return
48-
case res, more := <-c:
49-
if !more {
50-
return
51-
}
52-
to <- res
53-
}
54-
}
55-
}()
56-
return to, nil
57-
}
58-
5924
// Subscribe performs a subscribe operation on the given query and schema
6025
// To finish a subscription you can simply close the channel from inside the `Subscribe` function
6126
// currently does not support extensions hooks

0 commit comments

Comments
 (0)