Add WebSocketInterceptor

See gh-162
This commit is contained in:
Rossen Stoyanchev
2021-10-20 21:21:31 +01:00
parent 811d32b647
commit 20bae75ed8
23 changed files with 361 additions and 70 deletions

View File

@@ -115,12 +115,12 @@ transformation of the `graphql.ExecutionInput`:
class MyInterceptor implements WebInterceptor {
@Override
public Mono<WebOutput> intercept(WebInput webInput, WebGraphQlHandler next) {
public Mono<WebOutput> intercept(WebInput webInput, WebInterceptorChain chain) {
webInput.configureExecutionInput((executionInput, builder) -> {
Map<String, Object> map = ... ;
return builder.extensions(map).build();
});
return next.handle(webInput);
return chain.next(webInput);
}
}
----
@@ -133,8 +133,8 @@ the `graphql.ExecutionResult`:
class MyInterceptor implements WebInterceptor {
@Override
public Mono<WebOutput> intercept(WebInput webInput, WebGraphQlHandler next) {
return next.handle(webInput)
public Mono<WebOutput> intercept(WebInput webInput, WebInterceptorChain chain) {
return chain.next(webInput)
.map(webOutput -> {
Object data = webOutput.getData();
Object updatedData = ... ;