-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscraps
50 lines (32 loc) · 1.55 KB
/
scraps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
MISCELLANEOUS SCRAPS:
socket.on('disconnect',function(){
var ipInc = socket.handshake.address;
console.log('User ',ipInc,' disconnected.')
for (var i=0; i< allOscs.length;i++){
//loop thru all users. Change target user, then build
//freq list for all users.
if (allOscs[i].ip==ipInc){
//found the user, so remove their data!
allOscs.splice(i,1);
allUserNames.splice(i,1);
}
}
});
is there a way to forcibly remove a user from the list of socket 'clients'? I.e., to not listen to any events incoming from that user?
one way may be to generate a 'banned list'.
1)if user hasn't been active in 4000 ms, send to banned list and remove allOscs object
2)if user then rejoins (reloads site), remove from ban list (if present), and re-initiate user.
The overarching idea:
Most smartphones have accelerometers that tell us their current orientation (rotation in 3-space)
We can use this as input via:
window.addEventListener('deviceorientation',function(output){
})
From this, we get (among other stuff) three blips of data: alpha, beta, and gamma
addEventListener sends event to server (phone orientation)
server gets event
backend searches for user (by identifier), and adjusts their freq
backend collates all user freqs
back end sends out list of freqs (NO usernames!)
front end gets event
front end converts freqs to sounds: MUSIC!
should we define the initial user, or user with the same IP as server, as only 'output'? allFreqs.shift()