Migration from iframe Integration
2
3
5
Initialise SDK
const gameInstance = await Hub88Games.init({
provider_token: "...",
provider_pi: "...",
launcher_base_url: "https://launcher.server1.ih.testenv.io"
});<!-- Container for the game -->
<div id="game-container"></div>
<!-- Include the SDK -->
<script src="https://cdn.hub88.io/games-sdk/hub88-games-sdk-<version>.js"></script>
<script>
async function launchGame() {
try {
// Get authorization data from your backend
const authData = await fetch('/api/game/authorize', {
method: 'POST',
body: JSON.stringify({
game_code: 'btsg_csgo',
user: 'player123'
// ... other parameters
})
}).then(r => r.json());
// Initialize Hub88 Games SDK
const gameInstance = await Hub88Games.init({
// Required parameters (minimum needed)
provider_token: authData.provider_token,
provider_pid: authData.provider_pid, // Maps to provider_pid
launcher_base_url: authData.launcher_base_url,
// Optional parameters
containerId: 'game-container',
lang: 'en',
loginUrl: 'sendPostMessage', // or your login URL
depositUrl: 'sendPostMessage' // or your deposit URL
});
console.log('Game loaded successfully!');
} catch (error) {
console.error('Failed to load game:', error);
}
}
// Launch the game
launchGame();
</script>Last updated
Was this helpful?

