| get isConnected() { | get isConnected() { | ||||
| return State.websocket && State.websocket.readyState === 1 | 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 | const params = (new URL(document.location)).searchParams | ||||
| /* | /* | ||||
| * | * | ||||
| difference(message.online, State.online).forEach(username => { | difference(message.online, State.online).forEach(username => { | ||||
| if(username === State.username) return | if(username === State.username) return | ||||
| signal({kind: 'post', ts: message.ts, value: `${username} joined`}) | signal({kind: 'post', ts: message.ts, value: `${username} joined`}) | ||||
| signal({kind: 'join', value: username}) | |||||
| }) | }) | ||||
| difference(State.online, message.online).forEach(username => { | difference(State.online, message.online).forEach(username => { | ||||
| if(username === State.username) return | if(username === State.username) return | ||||
| signal({kind: 'post', ts: message.ts, value: `${username} left`}) | signal({kind: 'post', ts: message.ts, value: `${username} left`}) | ||||
| signal({kind: 'leave', value: username}) | |||||
| }) | }) | ||||
| } | } | ||||