Players sign in on Wavedash before they launch your game. The injected SDK receives credentials from the host page and attaches them to each API call. You never embed login UI inside the game.
Presence is currently available in the JavaScript SDK only. The Godot and Unity bindings do not expose presence methods yet.
Reading the current player
func print_player():
var user = WavedashSDK.get_user()
var user_id = WavedashSDK.get_user_id()
var username = WavedashSDK.get_username()
print(user_id, " ", username, " ", user)
| Method | Returns |
|---|---|
getUser() | Full profile object for the signed-in player |
getUserId() | Stable string ID |
getUsername() | Display name |
Gameplay tokens
Gameplay tokens are game-scoped and short-lived. Wavedash issues them when the session starts and the SDK attaches them to all API calls. When a token nears expiry, the SDK requests a fresh one. You do not read or store these tokens in normal game code.
Treat gameplay tokens as secrets at runtime. Do not log them or send them to your own servers.
Friends
The Friends API lets you retrieve the current player's friends list and display user avatars.
Listing friends
func _ready():
WavedashSDK.got_friends.connect(_on_got_friends)
func load_friends():
WavedashSDK.list_friends()
func _on_got_friends(response):
if response.get("success", false):
for friend in response.get("data", []):
print(friend["username"], " - Online: ", friend["isOnline"])
Friend data
| Field | Type | Description |
|---|---|---|
userId | string | Friend's user ID |
username | string | Display name |
avatarUrl | string? | URL to avatar (if set) |
isOnline | boolean | Whether currently online |
User avatars
Get a CDN URL for a user's avatar. Users must be cached (seen via friends list or lobby membership) first.
| Constant | Size | Use case |
|---|---|---|
AVATAR_SIZE_SMALL (0) | 64px | Lists, compact UI |
AVATAR_SIZE_MEDIUM (1) | 128px | Profile cards, chat |
AVATAR_SIZE_LARGE (2) | 256px | Full profile view |
func _ready():
WavedashSDK.user_avatar_loaded.connect(_on_avatar_loaded)
func load_friend_avatar(user_id: String):
WavedashSDK.get_user_avatar(user_id, WavedashConstants.AVATAR_SIZE_MEDIUM)
func _on_avatar_loaded(texture: Texture2D, user_id: String):
if texture:
$AvatarSprite.texture = texture
If getUserAvatarUrl() returns null, the user has not been cached yet or has no avatar set. Call listFriends() early to populate the cache.
Presence
The Presence API lets you share player status and activity with friends. Use it to show what players are doing and enable "join game" functionality.
The updateUserPresence method accepts an arbitrary data object — the SDK does not enforce a schema, so you can include any keys that are meaningful for your game. Common conventions include status, details, and lobbyId.
# Presence is not yet available in the Godot SDK.
Joinable games
Include a lobbyId in presence data to enable "Join Game" functionality on the platform:
await WavedashJS.updateUserPresence({
status: "In Lobby",
details: "Arena - Waiting",
lobbyId: lobbyId,
canJoin: lobbyUsers.length < maxPlayers
});
Clearing presence
await WavedashJS.updateUserPresence({});