Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drawing-app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sweng-group-15
drawing-app
Commits
d81a6b68
Commit
d81a6b68
authored
5 years ago
by
Moritz Langenstein
Committed by
Momo Langenstein
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
(ml5717) Set to full mesh mode and only send once connection established
parent
ac19e58a
No related branches found
Branches containing commit
No related tags found
1 merge request
!20
liowebrtc full mesh
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/liowebrtc
+1
-1
1 addition, 1 deletion
src/liowebrtc
src/y-webrtc/index.js
+36
-3
36 additions, 3 deletions
src/y-webrtc/index.js
with
37 additions
and
4 deletions
liowebrtc
@
afa8666f
Compare
14adace8
...
afa8666f
Subproject commit
14adace866d4c71c5a9e5e39129f770670d78427
Subproject commit
afa8666f796bdd40cc263354917632ea671dfee2
This diff is collapsed.
Click to expand it.
src/y-webrtc/index.js
+
36
−
3
View file @
d81a6b68
...
...
@@ -21,10 +21,10 @@ function extend(Y) {
const
webrtc
=
new
LioWebRTC
({
url
:
this
.
webrtcOptions
.
url
,
dataOnly
:
true
,
network
:
{
/*
network: {
minPeers: 4,
maxPeers: 8,
},
},
*/
})
this
.
webrtc
=
webrtc
...
...
@@ -32,6 +32,10 @@ function extend(Y) {
webrtc
.
on
(
"
ready
"
,
()
=>
{
webrtc
.
joinRoom
(
self
.
webrtcOptions
.
room
)
webrtc
.
connection
.
on
(
"
message
"
,
(
data
)
=>
console
.
log
(
"
socket.io
"
,
data
),
)
})
webrtc
.
on
(
"
joinedRoom
"
,
()
=>
{
...
...
@@ -46,14 +50,31 @@ function extend(Y) {
// Cannot use createdPeer here as y-js will then try to send data before the channel is open
webrtc
.
on
(
"
channelOpen
"
,
(
dataChannel
,
peer
)
=>
{
console
.
log
(
"
createdPeer
"
,
peer
.
id
,
this
.
webrtc
.
getPeers
().
map
((
peer
)
=>
peer
.
id
),
)
self
.
userJoined
(
peer
.
id
,
"
master
"
)
})
webrtc
.
on
(
"
receivedPeerData
"
,
(
type
,
message
,
peer
)
=>
{
if
(
message
.
type
!==
"
update
"
)
console
.
log
(
"
receivedData
"
,
peer
.
id
,
message
,
this
.
webrtc
.
getPeers
().
map
((
peer
)
=>
peer
.
id
),
)
self
.
receiveMessage
(
peer
.
id
,
message
)
})
webrtc
.
on
(
"
removedPeer
"
,
(
peer
)
=>
{
webrtc
.
on
(
"
channelClose
"
,
(
dataChannel
,
peer
)
=>
{
console
.
log
(
"
removedPeer
"
,
peer
.
id
,
this
.
webrtc
.
getPeers
().
map
((
peer
)
=>
peer
.
id
),
)
self
.
userLeft
(
peer
.
id
)
})
}
...
...
@@ -75,10 +96,22 @@ function extend(Y) {
}
send
(
uid
,
message
)
{
console
.
log
(
"
send
"
,
uid
,
message
,
this
.
webrtc
.
getPeers
().
map
((
peer
)
=>
peer
.
id
),
)
this
.
webrtc
.
whisper
(
this
.
webrtc
.
getPeerById
(
uid
),
"
y-js
"
,
message
)
}
broadcast
(
message
)
{
if
(
message
.
type
!==
"
update
"
)
console
.
log
(
"
broadcast
"
,
message
,
this
.
webrtc
.
getPeers
().
map
((
peer
)
=>
peer
.
id
),
)
this
.
webrtc
.
shout
(
"
y-js
"
,
message
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment