feat(session): prevent multiple simultaneous sessions on the same device#394
Open
Calais1986 wants to merge 2 commits into
Open
feat(session): prevent multiple simultaneous sessions on the same device#394Calais1986 wants to merge 2 commits into
Calais1986 wants to merge 2 commits into
Conversation
|
Sometimes end users may need to view device session from several browsers, for example on demos. No need to lock devices without desired intention |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This Pull Request introduces a mechanism to prevent multiple simultaneous ws-scrcpy sessions on the same device.
The goal is to avoid collisions, race conditions, and unexpected behavior caused by concurrent connections trying to control or stream the same device.
This implementation is compatible with the existing architecture and does not introduce breaking changes.
When a second client attempts to connect to a device that is already locked by an active session, the server now detects the conflict and rejects or defers the new connection.
What’s Included
✔ Device-level Session Lock
✔ Updated WebSocketServer logic
✔ New Device Lock Utility
A new module (
device-lock.ts) manages:✔ Cleanup Logic
Ensures locks are always released even in edge cases:
How It Works
{ "error": "device-in-use", "message": "Another session is active for this device" }