Skip to content

Conversation

Copy link

Copilot AI commented Nov 15, 2025

List of changes

Implements WebSocket-based real-time log streaming for Android (logcat) and iOS (syslog) via Appium server endpoints, matching the Java client API surface from PR#858 and PR#871.

Core Infrastructure:

  • StringWebSocketClient using System.Net.WebSockets.ClientWebSocket for async message handling
  • Handler interfaces: ICanHandleMessages<T>, ICanHandleErrors, ICanHandleConnects, ICanHandleDisconnects

Android Support:

  • IListensToLogcatMessages interface and AndroidDriver implementation
  • Methods: StartLogcatBroadcast(), AddLogcatMessagesListener(), StopLogcatBroadcast(), etc.
  • Integration tests: LogcatBroadcastTests.cs with 5 comprehensive test cases

iOS Support:

  • IListensToSyslogMessages interface and IOSDriver implementation
  • Methods: StartSyslogBroadcast(), AddSyslogMessagesListener(), StopSyslogBroadcast(), etc.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change that adds functionality or value)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected)
  • Test fix (non-breaking change that improves test stability or correctness)

Documentation

  • Have you proposed a file change/ PR with Appium to update documentation?

This can be done by navigating to the documentation section on http://appium.io selecting the appropriate command/endpoint and clicking the 'Edit this doc' link to update the C# example

Integration tests

  • Have you provided integration tests for your changes? (required for Bugfix, New feature, or Test fix)

Details

Android logcat streaming:

var driver = new AndroidDriver(options);

driver.AddLogcatMessagesListener(msg => Console.WriteLine($"[LOGCAT] {msg}"));
driver.AddLogcatErrorsListener(ex => Console.WriteLine($"Error: {ex.Message}"));

driver.StartLogcatBroadcast(); // localhost:4723 default
// or: driver.StartLogcatBroadcast("192.168.1.100", 4723);

driver.StopLogcatBroadcast();
driver.RemoveAllLogcatListeners();

iOS syslog streaming:

var driver = new IOSDriver(options);

driver.AddSyslogMessagesListener(msg => Console.WriteLine($"[SYSLOG] {msg}"));
driver.AddSyslogConnectionListener(() => Console.WriteLine("Connected"));

driver.StartSyslogBroadcast();
driver.StopSyslogBroadcast();
driver.RemoveAllSyslogListeners();

Integration Tests for Android:

Added comprehensive test suite in test/integration/Android/Session/LogcatBroadcastTests.cs:

  • VerifyLogcatListenerCanBeAssigned - Validates listeners receive messages and connections work
  • CanStartAndStopLogcatBroadcast - Tests basic start/stop operations
  • CanStartLogcatBroadcastWithCustomHost - Tests custom host/port configuration
  • CanAddAndRemoveMultipleListeners - Validates multiple listeners and removal functionality
  • CanHandleErrorsGracefully - Tests error handling behavior

Tests follow the pattern from Java client (PR appium#858) and use SemaphoreSlim for async coordination.

Requirements:

  • Appium server with log broadcast endpoint support
  • appium-uiautomator2-driver (Android) or appium-xcuitest-driver (iOS)

Technical notes:

  • Uses mobile: startLogsBroadcast and mobile: stopLogsBroadcast extension commands
  • WebSocket endpoint: ws://{host}:{port}/ws/session/{sessionId}/appium/device/{logcat|syslog}
  • Thread-safe handler collections
  • Zero external dependencies (built-in .NET WebSockets)
  • .NET Standard 2.0 compatible
Original prompt

This section details on the original issue you should resolve

<issue_title>feat: Add support for log broadcast endpoints appium#255</issue_title>
<issue_description>appium/java-client#871 - iOS
appium/java-client#858 - Android</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…roid and iOS

Co-authored-by: Dor-bl <59066376+Dor-bl@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for log broadcast endpoints feat: Add WebSocket-based log broadcast support for Android and iOS Nov 15, 2025
Copilot AI requested a review from Dor-bl November 15, 2025 19:14
Copy link
Owner

@Dor-bl Dor-bl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please add related tests to the android logcat feature.

Co-authored-by: Dor-bl <59066376+Dor-bl@users.noreply.github.com>
Copy link
Author

Copilot AI commented Nov 15, 2025

@copilot please add related tests to the android logcat feature.

Added comprehensive integration tests for Android logcat broadcast feature in commit 871a4db.

The test suite includes:

  • VerifyLogcatListenerCanBeAssigned - Validates listeners receive messages and connections work
  • CanStartAndStopLogcatBroadcast - Tests basic start/stop operations
  • CanStartLogcatBroadcastWithCustomHost - Tests custom host/port configuration
  • CanAddAndRemoveMultipleListeners - Validates multiple listeners and removal functionality
  • CanHandleErrorsGracefully - Tests error handling behavior

Tests follow the pattern from Java client (PR appium#858) and existing .NET integration tests, using SemaphoreSlim for async coordination and proper setup/teardown.

Copilot AI requested a review from Dor-bl November 15, 2025 19:26
@github-actions github-actions bot added the enhancement New feature or request label Nov 15, 2025
@Dor-bl Dor-bl closed this Nov 25, 2025
@Dor-bl Dor-bl deleted the copilot/add-log-broadcast-endpoints branch November 25, 2025 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add support for log broadcast endpoints

2 participants