velven
Docs
Menu

Test locally

On localhost the SDK answers with fakes, chosen in the page's query string, so you can build and draw everything before the space is listed.

View guide as Markdown

How it works

The SDK runs in the local environment on localhost, 127.0.0.1 and [::1], or on any host with ?velven_local=1. It decides at once, before looking for Velven, so nothing waits.

  • Scores go to an in-memory board per key, ranked by your page's own block: sort, mode, min, max and cooldown all apply. 3 fake players are seeded so the board has rows to draw. Nothing survives a reload.
  • Boards roll over as they do on Velven: daily at 00:00 UTC, weekly on Monday. bucket and season read past ones back. Only the current bucket is seeded.
  • A page submit to a server board is taken, with one console note that Velven would answer server_only, so you can build a server-tier page without its function.
  • Velven.data saves to localStorage under velven:data:local:alice for ?velven_user=alice, or velven:data:local:guest without it, so changing the query string switches saves. It survives a reload; clear it from the browser's storage panel.
  • With no block on the page, or one that does not parse, score calls answer no_board and the console says why, once. The same warning appears in every environment.

Query parameters

?velven_user=alice
Signs in a fake player, { id: "local-alice", handle: "alice", avatar: null }, with a fake token good for an hour. Without it, signIn answers signed_out, as for a guest.
?velven_token=expired
Makes the token already expired, so your refresh path runs and your server refuses it.
?velven_seed=120000,40000,9000
Sets the three seeded players' values, so the board looks like your game's. ?velven_seed=none seeds nobody.
?velven_strict=1
Refuses a page submit to a server board with server_only, as Velven does.
?velven_slow=800
Waits that many milliseconds before every answer, so your loading states show.
?velven_local=1
Uses the local environment on any host.

On your own site

A top-level window on any other host is the site environment. The space plays, sign-in and score calls answer unavailable, and Velven.data uses the page's own localStorage. Check Velven.environment before drawing a board.