Nebula
Gateway

SessionIds

Mesh-wide session ids.

generated from the sources
Static class in namespace Nebula · Packages/com.1by3.nebula/Runtime/Gateway/Sessions.cs
public static class SessionIds

Mesh-wide session ids. A gateway draws a random 32-bit incarnation when it starts and numbers its sessions from 1, so two gateways (or two starts of the same gateway) never hand out the same id without any coordination: id = incarnation << 32 | sequence. Workers key player state by this id, and it stays the same when the client reconnects through another gateway with its session token.

Methods

Make

public static ulong Make(uint incarnation, uint sequence);

Incarnation

public static uint Incarnation(ulong sessionId);

Sequence

public static uint Sequence(ulong sessionId);

NewIncarnation

public static uint NewIncarnation();

A fresh incarnation: random, never 0 (0 is "no incarnation" on the wire).

On this page