Get Screen Stream URL
Use this Java or Node.js SDK method to watch the device screen of an active session. The method returns a wss URL that already includes the caller's 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.
Before You Begin
- Start a session and keep its sessionId.
- Use a session that belongs to the authenticated client.
- Treat the returned URL as a secret. It contains the current access token.
SDK Method
Java | Node.js | .NET |
|---|---|---|
client.sessions().streamUrl(sessionId) | await client.sessions().streamUrl(sessionId) | Not available |
Java streamUrl returns a String. Node.js streamUrl returns Promise<string>.
Parameter
Parameter | Required | Description |
|---|---|---|
sessionId | Yes | Identifier returned by Start Session |
A blank sessionId throws IllegalArgumentException in Java and DeviceParkConfigError in Node.js before the request is sent.
Request Mapping
The Java and Node.js SDKs call:
GET /session/api/v2/public/sessions/{sessionId}/stream-urlThere is no request body. OAuth authorization is managed by the SDK client.
Device Park returns the stream address without a token:
{
"url": "wss://stream.example/ws/v2/devicepark/sessions/session-123/stream"
}The SDK appends the current access token as the token query parameter and returns the complete URL. When the address already has a query string, the token is appended with &. The token value is URL-encoded.
wss://stream.example/ws/v2/devicepark/sessions/session-123/stream?token=<access-token>Do not log this URL, and do not persist it. The token is the caller's current access token and will expire.
Example
String streamUrl = client.sessions().streamUrl("session-123");const streamUrl = await client.sessions().streamUrl("session-123");Open streamUrl with a WebSocket client. Refresh the URL by calling streamUrl again after the access token is renewed.
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.