WebRTC 工作流程
用户 A 服务器
用户 B
上线
上线
emit 'online' ->
'online'
on 'online'
'online' ->
on 'online'
on 'online'
获得在线用户列表
获得在线用户列表
选择用户 B
确认要和用户 B 聊天
emit 'request chat' ->
on 'request chat'
emit 'request chat' ->
on 'request chat'
getUserMedia()
'stream ok'
on 'stream ok'
'stream ok'
on 'stream ok'
getUserMedia()
emit 'stream ok' ->
on 'stream ok'
emit 'stream ok' ->
on 'stream ok'
createPeerConnection()
pc.createOffer()
pc.setLocalDescription()
'offer'
on 'offer'
'offer'
on 'offer'
createPeerConnection()
pc.setRemoteDescription
pc.createAnswer()
pc.setLocalDescription()
emit 'answer' ->
on 'answer'
emit 'answer' ->
on 'answer'
pc.setRemoteDescription() 这样就能进行视频聊天了。 其中
createPeerConnection 过程如下:全选
emit/用户/'s/tream/Peer/Connection/Description/chat/answer/create/
emit/用户/'s/tream/Peer/Connection/Description/chat/answer/create/
-->