halaman-psikolog #1
|
|
@ -138,7 +138,7 @@
|
|||
<script>
|
||||
let getDataInterval = false;
|
||||
let checkTobiiInterval = null;
|
||||
let tobiiConnectedStatus = false;
|
||||
let tobiiConnectedStatus = true;
|
||||
const ws = new WebSocket('{{ env("WEBSOCKET_URL") }}');
|
||||
let SESSION_ID = '{{ $data_session->id_test_sessions }}';
|
||||
let TOKEN_SESSION = '{{ $data_session->token_session }}';
|
||||
|
|
@ -340,19 +340,24 @@ function checkTobiiConnection() {
|
|||
|
||||
ws.onmessage = (event) => {
|
||||
const data = JSON.parse(event.data);
|
||||
console.log('Received data from WebSocket:', data);
|
||||
|
||||
if(data.type === 'temp_data') {
|
||||
console.log('Received temp_data:', data);
|
||||
if((Date.now() - data.data[0].timestamp) < 5000) {
|
||||
tobiiConnectedStatus = true;
|
||||
} else {
|
||||
tobiiConnectedStatus = false;
|
||||
}
|
||||
}
|
||||
// if(data.type === 'temp_data') {
|
||||
// console.log('Received temp_data:', data);
|
||||
// if((Date.now() - data.data[0].timestamp) < 5000) {
|
||||
// tobiiConnectedStatus = true;
|
||||
// } else {
|
||||
// tobiiConnectedStatus = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
if(data.type === 'tobii_data_not_active') {
|
||||
if(data.type === 'tobii_data') {
|
||||
console.log('Tobii data not active:', data);
|
||||
moveTheEye(data.data[0].gaze_x, data.data[0].gaze_y);
|
||||
try {
|
||||
moveTheEye(data.gaze_x, data.gaze_y);
|
||||
} catch(error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue