Get Screen Stream Ticket
Use this SDK method to watch the device screen of an active session. The method returns a wss URL that carries a single-use ticket instead of an access token.
The SDK does not open the socket or render the screen. Pass the returned URL to a WebSocket client that can display the device stream.
Prefer this method over Get Screen Stream URL in new .NET integrations. A ticket is scoped to one connection, so a leaked URL cannot be replayed the way a URL holding a live access token can.
Before You Begin
- Start a session and keep its sessionId.
- Use a session that belongs to the authenticated client and is active.
- Treat the returned URL as a secret and request a new one for every connection.
SDK Method
Java | Node.js | .NET |
|---|---|---|
client.sessions().streamTicketUrl(sessionId) | await client.sessions().streamTicketUrl(sessionId) | await client.Sessions.StreamTicketUrlAsync(sessionId) |
Java streamTicketUrl returns a String. Node.js streamTicketUrl returns Promise<string>. .NET StreamTicketUrlAsync returns Task<string> and accepts an optional trailing CancellationToken.
Parameter
Parameter | Required | Description |
|---|---|---|
sessionId | Yes | Identifier returned by Start Session |
A blank sessionId throws IllegalArgumentException in Java, DeviceParkConfigError in Node.js and DeviceParkConfigException in .NET before the request is sent.
Request Mapping
The SDKs call:
POST /session/api/v2/public/sessions/{sessionId}/stream-ticketThere is no request body. OAuth authorization is managed by the SDK client.
Device Park returns the stream address with the ticket already in place:
{
"url": "wss://stream.example/ws/v2/devicepark/sessions/session-123/stream?ticket=<one-time-ticket>"
}The SDK returns that URL unchanged. It does not append an access token. When the response carries no url, the SDK throws IllegalStateException in Java, an Error in Node.js and DeviceParkException in .NET.
Ticket Lifetime
Every call mints a new ticket. Do not reuse a returned URL, including after a failed connection attempt — call the method again instead. Do not log the URL and do not persist it.
Example
String streamUrl = client.sessions().streamTicketUrl("session-123");const streamUrl = await client.sessions().streamTicketUrl("session-123");var streamUrl = await client.Sessions.StreamTicketUrlAsync("session-123");Open streamUrl with a WebSocket client. To reconnect, call the method again for a fresh ticket.
What Happens Next?
- Continue the Appium test while the screen is visible.
- Stop the session when the interaction is finished.
This URL is the live device screen. It is separate from Session.videoRecordUrl, which is the HLS playlist for a completed recording.