Hello,
I am a developer currently working on developing an iPhone app for OGS. However, I have been puzzled at how to incorporate OGS Player Matching System into the application. Therefore, I wonder should I use RT or REST API to call the player matching? Otherwise, is there a way to start an OGS matching in Swift?
Thank you so much!
I could easily be wrong, but as far as I know, you have to be listening to this socket to hear about challenge system updates:
const ai_config = {
reconnection: true,
reconnectionDelay: 750,
reconnectionDelayMax: 10000,
transports: ["websocket"],
upgrade: false,
};
export const termination_socket = window['websocket_host'] ? io(window['websocket_host'], io_config) : io(io_config);
export const comm_socket = termination_socket;
export let ai_host = '';
if (window.location.hostname.indexOf('dev.beta') >= 0 && window['websocket_host'] === "https://online-go.com") {
// if we're developing locally but connecting to the production system, use our local system for estimation
ai_host = `http://localhost:13284`;
console.log("AI Host set to: ", ai_host);
} else if (window.location.hostname.indexOf('beta') >= 0 || window.location.hostname.indexOf('dev') >= 0) {
ai_host = 'https://beta-ai.online-go.com';
} else if (window.location.hostname.indexOf('online-go.com') >= 0) {
ai_host = 'https://ai.online-go.com';
Like this:
this.socket.on("connect", this.onConnect);
this.socket.on("disconnect", this.onDisconnect);
this.socket.on("seekgraph/global", this.onSeekgraphGlobal);
The REST API provide means to interact (creating, accepting)
A challenge creation is a POST as per
*/
console.log(challenge);
if (challenge.game.initial_state && Object.keys(challenge.game.initial_state).length === 0) {
challenge.game.initial_state = null;
}
this.saveSettings();
this.close();
post(player_id ? "players/%%/challenge" : "challenges", player_id, challenge)
.then((res) => {
console.log("Challenge response: ", res);
const challenge_id = res.challenge;
const game_id = typeof(res.game) === "object" ? res.game.id : res.game;
let keepalive_interval;
notification_manager.event_emitter.on("notification", checkForReject);
if (open_now) {
if (this.props.mode !== "open") {
1 Like
fmansa
December 19, 2021, 11:24pm
3
Maybe you should look at the code for the iOS app surround (there’s a thread for it somewhere here) AFAIK it’s open source and it integrates the matching system.
2 Likes
Thank you! It helped a lot!
1 Like