Request for Documentation and Guidance on POST /1.0/sessions Endpoint in Anbox Streaming Gateway

Hello Anbox Cloud Developers,

I hope this message finds you well.

I am writing to request assistance regarding the POST /1.0/sessions endpoint in the Anbox Streaming Gateway as documented in the Swagger UI (Swagger UI). I have encountered two main issues:

  1. Lack of Documentation for Request Body: In the Swagger UI, the POST /1.0/sessions request is shown, but the request body is not documented, resulting in an empty object. Could you please provide detailed documentation on the required structure and parameters for the request body?
  2. Starting an Application with ADB Ports Exposed: Additionally, I would like to know if there is a way to start an application with ADB ports exposed using this endpoint, aiming to achieve the equivalent of the -s +adb flag in the amc launch command… If so, could you provide guidance or examples on how to achieve this?

Thank you for your attention and assistance.

Best regards,
Marco

Hi!

Thanks for your message.

For both of your questions, we would suggest that you use the new AMS-based API instead to achieve your goal. Please see POST 1.0/instances.

For your use case, the request could be something along those lines:

{
  "config": {
    "display": {
      "density": 120,
      "fps": 60,
      "height": 720,
      "width": 1270
    },
    "enable_streaming": true,
    "platform": "webrtc"
  },
  "services": [
    {
      "expose": true,
      "name": "adb",
      "port": 5559,
      "port_end": 5559,
      "protocols": [
        "tcp",
      ]
    }
  ],
}

We apologize for the missing documentation for the /1.0/sessions endpoint. We are tracking that issue here: Bug #2071903 “Stream Gateway Swagger API is missing /1.0/session...” : Bugs : Anbox Cloud.
In the meantime, here are the relevant go structs with documentation:

// Screen represents a session screen specification
type Screen struct {
	// Width of the screen
	Width int `json:"width" minimum:"1" example:"1280"`
	// Height of the screen
	Height int `json:"height" minimum:"1" example:"720"`
	// FPS the video stream will use
	FPS int `json:"fps" minimum:"1" example:"25"`
	// Display density Android will be configured with. See https://developer.android.com/training/multiscreen/screendensities
	// for more details
	Density int `json:"density" minimum:"72" default:"240" example:"240"`
}

// SessionPost is used to create a new session for the specified application
// and configuration
type SessionPost struct {
	// Region the session should be created in. If left empty a region is randomly
	// selected.
	Region string `json:"region,omitempty" example:"us-west-1"`
	// Application the session should be created for
	App string `json:"app" example:"com.foo.bar"`
	// Which specific version of the application to launch for the session. If
	// not specified, the last published version is launched.
	AppVersion *int `json:"app_version,omitempty" example:"0"`
	// Definition of the screen dimensions. The maximum allowd screen resolution is
	// 4k (3840 x 2160).
	Screen Screen `json:"screen"`
	// Makes the session joinable by another client after the initial client left.
	// Requires idle_time_min to be set.
	Joinable bool `json:"joinable" example:"true"`
	// Time in minutes a session stays idle without any client connected. The
	// value "0" is special and causes the container to stay alive until the
	// session is terminated by an API call or the container decide on its own
	// to shutdown.
	IdleTimeMin *int `json:"idle_time_min,omitempty" example:"5"`
	// Extra data passed as part of the userdata to the container
	ExtraData json.RawMessage `json:"extra_data,omitempty" example:"userid=123"`
	// Ephemeral controls whether the session should be deleted after the client
	// disconnects or not. If the containers runs into an error, the session is kept
	// if with Ephemeral set to true.
	Ephemeral *bool `json:"ephemeral,omitempty" example:"false" default:"true"`
}

Hope that helps!

Alexis

Hello Alexis,

Thank you for the detailed explanation regarding the new AMS-based API.

I have a couple of follow-up questions:

  1. Will this new API also be utilized in the Anbox Streaming SDK (JavaScript) in the future?
  2. Is it possible to set an idle time for the instance using this new API, similar to how it is currently done with the session.idle_time_min field in the Anbox Streaming SDK? If not, is this something that needs to be managed manually?

Thank you for your assistance.

Best regards,
Marco

Hi Marco,

For 1., there is currently no plan to add this new API to the Anbox Streaming SDK.

For 2., it’s currently not possible with this new API. You will need to manage this manually, or you first create an application with the services you want (see POST /1.0/applications), and then create a session from that application.

In both cases, please file a request in our bug tracker if you want us to add these features to future versions.

Hope this helps!

Alexis

Hello Alexis,

Thank you so much for the detailed clarifications and your kindness in addressing my questions. I greatly appreciate the time you took to help me understand the new API and its features.

Best regards,
Marco