This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
public class SubscriptionResolver implements GraphQLSubscriptionResolver { | |
@Autowired | |
private Flux<Game> gameEvents; | |
@Autowired | |
private AuthManager authManager; | |
@PreAuthorize("isAuthenticated()") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
public class SubscriptionConnectionListener implements ApolloSubscriptionConnectionListener { | |
@Autowired | |
private Authenticator authenticator; | |
@Override | |
public void onConnect(SubscriptionSession session, OperationMessage message) { | |
Map<String, String> payload = (Map<String, String>) message.getPayload(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
public class SubscriptionResolver implements GraphQLSubscriptionResolver { | |
@Autowired | |
private Flux<Game> gameEvents; | |
public Publisher<String> opponentArrived() { | |
return gameEvents | |
.filter(game -> !game.isStarted()) | |
.map(game -> game.getSecondPlayer().getName()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
public class MutationResolver implements GraphQLMutationResolver { | |
@Autowired | |
private GameService gameService; | |
@Autowired | |
private AuthManager authManager; | |
@Autowired |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public class SubscriptionConfig { | |
@Bean | |
public Many<Game> gameSink() { | |
return Sinks.many().multicast().onBackpressureBuffer(Queues.SMALL_BUFFER_SIZE, false); | |
} | |
@Bean | |
public Flux<Game> gameFlux(Many<Game> gameSink) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
public class SubscriptionResolver implements GraphQLSubscriptionResolver { | |
public Publisher<String> opponentArrived() { | |
// Do something here... | |
} | |
public Publisher<Game> opponentMove() { | |
// Do something here... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"A cell of the game board" | |
type Cell { | |
"The row of this cell (0..2)" | |
row: Int! | |
"The column of this cell (0..2)" | |
column: Int! | |
"The value assigned to this cell (e.g. 'X', 'O'), or null if the cell is empty" | |
value: String | |
} |