Dev's NoxDev's Nox
Relay Protocol

Sessions

Retrieval of the list of available instances with pagination for navigation.

The Sessions message allows clients to retrieve the list of instances available on the server.

It uses a pagination system to efficiently handle large lists of instances.

Priority

Normal - This message has a normal priority because it is an information lookup.

The Sessions message requires the client to have completed the Handshake. Requests sent before the handshake will be ignored by the server.


Client → Server Request

Payload Format

[pagination: byte]

Detailed Structure

TypeNameDescription
bytePaginationPage number to retrieve (0-based)

Request Example

[0x00]                          // Pagination = 0 (first page)

Request Example - Next Page

[0x02]                          // Pagination = 2 (third page)

Server → Client Response

Payload Format

[instance_count: byte]
[current_page: byte]
[total_pages: byte]
[instances: Instance[instance_count]]

Instance Structure

[flags: uint]
[internal_id: byte]
[master_id: uint]
[current_players: ushort]
[capacity: ushort]

Detailed Structure

TypeNameDescription
byteInstanceCountNumber of instances in this page
byteCurrentPageNumber of the current page
byteTotalPagesTotal number of available pages
uintFlagsInstance configuration flags
byteInternalIDInternal ID of the instance on this relay
uintMasterIDID of the instance on the Master Server
ushortCurrentPlayersNumber of currently connected players
ushortCapacityMaximum capacity of the instance

Instance Flags

ValueNameDescription
0x01IsPublicInstance publicly visible
0x02UsePasswordPassword protection
0x04UseWhitelistWhitelist access control
0x08AuthorizeBotAllows bot connections
0x10AllowOverloadAllows exceeding the capacity

Response Example - Page with Instances

[0x02]                          // InstanceCount = 2
[0x00]                          // CurrentPage = 0
[0x01]                          // TotalPages = 1
// Instance 1
[0x00, 0x00, 0x00, 0x01]        // Flags = IsPublic
[0x05]                          // InternalID = 5
[0x00, 0x00, 0x04, 0x2A]        // MasterID = 1066
[0x00, 0x08]                    // CurrentPlayers = 8
[0x00, 0x20]                    // Capacity = 32
// Instance 2
[0x00, 0x00, 0x00, 0x03]        // Flags = IsPublic | UsePassword
[0x03]                          // InternalID = 3
[0x00, 0x00, 0x05, 0x39]        // MasterID = 1337
[0x00, 0x04]                    // CurrentPlayers = 4
[0x00, 0x10]                    // Capacity = 16

Response Example - Empty Page

[0x00]                          // InstanceCount = 0
[0x02]                          // CurrentPage = 2
[0x02]                          // TotalPages = 2

Response Example - Invalid Page

[0x00]                          // InstanceCount = 0
[0x05]                          // CurrentPage = 5 (requested)
[0x03]                          // TotalPages = 3 (maximum available)

Pagination System

Automatic Calculation

The server automatically computes the number of pages based on:

  • Maximum size: MaxPacketSize - 2 bytes per page
  • Instance limit: Maximum 255 instances per page (byte.MaxValue)
  • Size per instance: About 15 bytes per instance

Page Handling

  • Pages 0-based: The first page is 0
  • Invalid page: If pagination >= totalPages, returns an empty page
  • Dynamic calculation: The number of pages may change between requests

Optimization

The system automatically optimizes the distribution to maximize the use of the available bandwidth.


Processing

Server Side

  1. State validation: Check that the client has completed the handshake
  2. Pagination read: Extraction of the requested page number
  3. Page computation: Dynamic generation of pages according to the packet size
  4. Page validation: Check that the requested page exists
  5. Response building: Assembly of the instance data
  6. Sending: Transmission of the requested page

Client Side

  1. Request sending: Specification of the desired page
  2. Response reception: Processing of the instance data
  3. Pagination handling: Navigation between the available pages
  4. Interface update: Display of the instances with their statuses

Special Behaviors

Dynamic Pages

The content and the number of pages may change between requests:

  • New instances created
  • Instances removed
  • Change in the number of players

Private Instances

Instances with IsPublic = false are not included in the public sessions list.

Real-Time Data

The returned information reflects the current state:

  • Number of connected players
  • Status of the instance flags
  • Availability of the instances

Integration with Other Messages

Relation with Enter

The Sessions information allows choosing an instance before using Enter:

  • InternalID: Used to join the instance
  • Flags: Indicate the prerequisites (password, whitelist)
  • Capacity: Allows checking availability

Relation with ServerConfig

Changes via ServerConfig immediately affect the data returned by Sessions.

Error Handling

Nonexistent Page

If the requested page does not exist, the server returns:

  • InstanceCount = 0
  • CurrentPage = requested page
  • TotalPages = real number of pages

No Instance

If the server has no public instance:

  • InstanceCount = 0
  • CurrentPage = 0
  • TotalPages = 0

Disconnection Required

Requests before the handshake are silently ignored.


Optimizations

Caching

Clients may cache the Sessions data to:

  • Reduce the request frequency
  • Improve the interface responsiveness
  • Limit the server load

Smart Pagination

Recommended strategies:

  • Load the first page immediately
  • Preload the following pages if necessary
  • Refresh only when a change is detected

Compression

The compact format (15 bytes per instance) allows:

  • About 68 instances per 1024-byte packet
  • Efficient transmission even with many instances
  • Reduced network latency

On this page