diff --git a/backend/index.js b/backend/index.js index d17f006..19bda9c 100644 --- a/backend/index.js +++ b/backend/index.js @@ -37,7 +37,7 @@ const io = require('socket.io')(server, { } }); -var Twitter = require('twitter-lite'); +//var Twitter = require('twitter-lite'); //io.origins('*:*'); @@ -273,8 +273,6 @@ app.use(function (err, req, res, next) { }); -app.get('/:shortName/clients', get_clients); -app.get('/clients', get_clients); function notify_clients(call) { call.type = "calls"; @@ -392,7 +390,7 @@ io.sockets.on('connection', function (client) { if (clients[client.id]) { clients[client.id].active = false; } else { - console.error("Error - Socket.io [Stop] either client not found "); + console.error("Error - Socket.io [Stop] Client not found "); } }); client.on('disconnect', function () { diff --git a/frontend/src/Call/CallPlayer.js b/frontend/src/Call/CallPlayer.js index 44738c1..0038eaa 100644 --- a/frontend/src/Call/CallPlayer.js +++ b/frontend/src/Call/CallPlayer.js @@ -82,11 +82,14 @@ function CallPlayer(props) { if (autoPlay && (currentIndex > 0)) { const nextCallId = callsData.ids[currentIndex - 1]; const nextCall = callsData.entities[nextCallId]; - + console.log("Autoplaying next call, current Index is: " + currentIndex + " isPlaying is: " + isPlaying ) setCurrentCall(nextCall); dispatch(playedCall(nextCall._id)); setIsPlaying(true); } else { + if (!autoPlay) { + console.log("Not playing because Autoplay is false - current index is: " + currentIndex) + } setIsPlaying(false); } } else { @@ -114,15 +117,19 @@ function CallPlayer(props) { // we should only set the selectCallId to be the current call when AutoPlay is selected // and when there isn't another call already playing useEffect(() => { + console.log("New selected call: " + selectCallId + " IsPlaying: " + isPlaying + " autoPlay: " + autoPlay ); if (selectCallId && callsData && !isPlaying && autoPlay) { const call = callsData.entities[selectCallId]; if (call) { + const time = new Date(call.time); + + console.log("Playing Selected Call: " + call._id + " Start Time: " + time.toLocaleTimeString() ); setIsPlaying(true); setCurrentCall(call); dispatch(playedCall(call._id)); } } - }, [selectCallId, callsData]) + }, [selectCallId]) return ( diff --git a/frontend/src/Call/Calls.js b/frontend/src/Call/Calls.js index aa2e17e..2030ef0 100644 --- a/frontend/src/Call/Calls.js +++ b/frontend/src/Call/Calls.js @@ -114,8 +114,8 @@ function Calls(props) { } setSelectCallId(message._id); dispatch(addCall(message)); - - console.log("Got Socket Message: " + message._id); + const time = new Date(message.time); + console.log("Got Socket Message: " + message._id + " Start Time: " + time.toLocaleTimeString() ); break default: break @@ -124,7 +124,7 @@ function Calls(props) { const startSocket = () => { const filter = getFilterDescription(); - console.log("Starting Socket"); + console.log("Starting Socket - Filter Code: " + filter.code + " Filter Type: " + filter.type); socket.emit("start", { filterCode: filter.code, filterType: filter.type, @@ -200,10 +200,12 @@ function Calls(props) { const handleNewer = () => { - if (positionRef.current && !live) { + if (positionRef.current) { pageYOffset.current = {direction: "top", position: positionRef.current.clientHeight}; } - dispatch(getNewerCalls({})); + if (!live) { + dispatch(getNewerCalls({})); + } } const handleOlder = () => {