Added proper state machine to websocket video stream to control connect/disconnect sequence better. (#561)

This commit is contained in:
Chris Gerth
2022-11-03 15:05:17 -05:00
committed by GitHub
parent e971db2f52
commit a64697e714
4 changed files with 290 additions and 100 deletions

View File

@@ -69,10 +69,13 @@ public class SocketVideoStreamManager {
// Indicate a user would like to stop receiving one camera stream
public void removeSubscription(WsContext user) {
var port = userSubscriptions.get(user);
if (port != null) {
if (port != null && port != NO_STREAM_PORT) {
var stream = streams.get(port);
userSubscriptions.put(user, NO_STREAM_PORT);
stream.removeUser();
} else {
logger.error(
"User attempted to unsubscribe, but had not yet previously subscribed successfully.");
}
}