This repository has been archived by the owner on Jul 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Connecting to Interactive
JoshSnider edited this page Apr 19, 2018
·
9 revisions
In order to connect to interactive and create a session you must first get authorization from the user.
// Get an authorization token for the user to pass to the connect function.
std::string authorization;
int error = authorize(authorization);
if (error) return error;
See the Authorization page for more details.
Create a session by calling interactive_open_session
with the previously obtained authorization string.
// Connect to the user's interactive channel, using the interactive project specified by the version ID.
interactive_session session;
int error = interactive_open_session(authorization.c_str(), INTERACTIVE_ID, SHARE_CODE, true, &session);
if (error) return error;
You will almost certainly want to handle on_input
and perhaps some other callbacks such as on_error
or on_state_changed
.
err = interactive_register_input_handler(session, handle_interactive_input);
if (err) return err;
See Handling Input for more details about how you might handle input from the interactive service.