aboutsummaryrefslogtreecommitdiff
path: root/modern/src/SocketController.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-07-03 13:08:16 -0700
committerAnton Tananaev <anton@traccar.org>2022-07-03 13:08:16 -0700
commit5aed7b5c541f8eb4de1ec47fa07be3f777eaf32c (patch)
tree8beecd7897623695b0cde282f9e94c1d03c77264 /modern/src/SocketController.js
parentf06773eca33fd99bbdaf8163e6e6598bd75d25f7 (diff)
downloadtrackermap-web-5aed7b5c541f8eb4de1ec47fa07be3f777eaf32c.tar.gz
trackermap-web-5aed7b5c541f8eb4de1ec47fa07be3f777eaf32c.tar.bz2
trackermap-web-5aed7b5c541f8eb4de1ec47fa07be3f777eaf32c.zip
Respect events feature flag
Diffstat (limited to 'modern/src/SocketController.js')
-rw-r--r--modern/src/SocketController.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/modern/src/SocketController.js b/modern/src/SocketController.js
index bfc0378d..baecbfce 100644
--- a/modern/src/SocketController.js
+++ b/modern/src/SocketController.js
@@ -11,6 +11,7 @@ import usePersistedState from './common/util/usePersistedState';
import alarm from './resources/alarm.mp3';
import { eventsActions } from './store/events';
+import useFeatures from './common/util/useFeatures';
const SocketController = () => {
const dispatch = useDispatch();
@@ -28,6 +29,8 @@ const SocketController = () => {
const [soundEvents] = usePersistedState('soundEvents', []);
const [soundAlarms] = usePersistedState('soundAlarms', ['sos']);
+ const features = useFeatures();
+
const connectSocket = () => {
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const socket = new WebSocket(`${protocol}//${window.location.host}/api/socket`);
@@ -61,7 +64,9 @@ const SocketController = () => {
dispatch(positionsActions.update(data.positions));
}
if (data.events) {
- dispatch(eventsActions.add(data.events));
+ if (!features.disableEvents) {
+ dispatch(eventsActions.add(data.events));
+ }
setEvents(data.events);
}
};