entanglement server
This commit is contained in:
@@ -18,7 +18,7 @@ export default class Entanglement {
|
||||
async __create_websocket() {
|
||||
const host = window.location.host
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws'
|
||||
const ws = new WebSocket(`${protocol}://${host}/entanglement`)
|
||||
const ws = new WebSocket(`${protocol}://${host}/entanglement?name=sato&channel=chat`)
|
||||
ws.onopen = () => console.log('websocket 连接成功')
|
||||
ws.onclose = async () => {
|
||||
console.log('websocket 连接关闭, 3s后尝试重新连接...')
|
||||
@@ -34,7 +34,7 @@ export default class Entanglement {
|
||||
const data = JSON.parse(event.data)
|
||||
//console.log('收到消息', data)
|
||||
if (data.type === 'list') {
|
||||
console.debug('收到已在线对端列表', data.list)
|
||||
console.debug('收到在线列表', data.list)
|
||||
this.users = Promise.all(data.list.map(async user => {
|
||||
console.debug('发送给', user.name, 'offer')
|
||||
const pc = this.__create_webrtc()
|
||||
|
Reference in New Issue
Block a user