Sessions
What is a session?
A session is created automatically when a WebSocket client connects to port 10001. One connection = one session. When the connection closes, the session is destroyed and its configuration is discarded.
Each session has:
- A numeric ID (auto-assigned by the service)
- An optional profile name (you set this)
- Its own view of every device: basis, mount, preset, filters, and workspace transform
Multiple sessions can coexist — e.g., your Unity app on one session and Haply Hub observing on another. They each see the same physical device but with their own coordinate settings.
Setting a profile name
It's strongly recommended to set a profile name on your first message:
{
"session": {
"configure": {
"profile": {
"name": "co.mycompany.myapp:1.4::main-scene"
}
}
}
}
Why it matters:
- Haply Hub uses the profile name to recognise your simulation and let you tweak device settings (workspace, basis, mount, filters) from its UI.
- Those tweaks are persisted — next time you run the same app, Hub automatically re-applies them without any code change on your side.
- Other sessions (or HTTP clients) can target your session by profile name
using a session selector:
?session=myapp:0. Profile selectors also accept*/?glob wildcards, so a namespace like?session=co.haply.hub::*:0works without having to know the full profile.
Profile name format
Recommended format: <app id>:<X.Y>[::<sub>]
| Part | What | Example |
|---|---|---|
<app id> | Your application, as a reverse domain name | co.mycompany.myapp |
<X.Y> | Your application's version: major and minor only | 1.4 |
::<sub> | Optional. Anything that tells sessions of the same app and version apart: a scene, an edition, a mode | ::main-scene, ::pro |
Examples: co.mycompany.myapp:1.4, co.mycompany.myapp:1.4::main-scene,
com.example.modeler:2026.3::pro.
- The version lets Haply Hub tell your releases apart: a new release can get settings that fit it, while older releases keep theirs.
- Major and minor only: a patch release keeps the same profile, and the settings saved for it.
- The
::<sub>part comes last, so anything that matches on the app and version (co.mycompany.myapp:1.4, or a glob such asco.mycompany.myapp:*) still matches every sub-profile. - Keep
<sub>non-numeric: in a session selector, a trailing:<integer>is read as the session index (?session=co.mycompany.myapp:1.4::main-scene:0is the first session with that profile).
Remote control (cross-session configuration)
A session's devices can be reconfigured from outside — by another WebSocket session, or by an HTTP client with no WebSocket connection at all. This is how Haply Hub tweaks your app's settings.
The HTTP client uses session selectors to target the right session:
# List all sessions
curl http://localhost:10001/sessions
# Look up a single session directly (path-form of the selector — same
# expressions as `?session=`, see Selectors for the full grammar)
curl http://localhost:10001/sessions/:myapp:0
# Change the basis on session with profile "myapp" (first match)
curl -X POST "http://localhost:10001/inverse3/0/config/basis?session=myapp:0" \
-H "Content-Type: application/json" \
-d '{"permutation": "XZY"}'
# Same, but target the first session in a namespace (profile wildcard)
curl -X POST "http://localhost:10001/inverse3/0/config/basis?session=co.haply.hub::*:0" \
-H "Content-Type: application/json" \
-d '{"permutation": "XZY"}'
See the HTTP Remote Config tutorial for a full worked example of cross-session HTTP control.