|
|
@@ -5,7 +5,15 @@ const State = Object.seal({ |
|
|
|
get isConnected() { |
|
|
|
return State.websocket && State.websocket.readyState === 1 |
|
|
|
}, |
|
|
|
get others() { |
|
|
|
return State.online.filter(username => username != State.username) |
|
|
|
} |
|
|
|
}) |
|
|
|
const rpcConfig = {iceServers: [{ |
|
|
|
urls: ['stun:stun.pico.chat:5349', 'turn:turn.pico.chat:5349'], |
|
|
|
username: 'roderic', |
|
|
|
credential: 'tomodachi', |
|
|
|
}]} |
|
|
|
const params = (new URL(document.location)).searchParams |
|
|
|
/* |
|
|
|
* |
|
|
@@ -60,10 +68,12 @@ const connect = (username) => { |
|
|
|
difference(message.online, State.online).forEach(username => { |
|
|
|
if(username === State.username) return |
|
|
|
signal({kind: 'post', ts: message.ts, value: `${username} joined`}) |
|
|
|
signal({kind: 'join', value: username}) |
|
|
|
}) |
|
|
|
difference(State.online, message.online).forEach(username => { |
|
|
|
if(username === State.username) return |
|
|
|
signal({kind: 'post', ts: message.ts, value: `${username} left`}) |
|
|
|
signal({kind: 'leave', value: username}) |
|
|
|
}) |
|
|
|
} |
|
|
|
|