ion-sfu icon indicating copy to clipboard operation
ion-sfu copied to clipboard

Add notification to the middleware of peer removal.

Open tmiv opened this issue 2 years ago • 3 comments

Description

This change allows data channel middleware to register a callback for when a peer disconnects.

Reference issue

Fixes #572

tmiv avatar Aug 22 '21 17:08 tmiv

Codecov Report

Merging #573 (27905a4) into master (d7b670b) will decrease coverage by 0.11%. The diff coverage is 0.00%.

:exclamation: Current head 27905a4 differs from pull request most recent head 253755f. Consider uploading reports for the commit 253755f to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##           master     #573      +/-   ##
==========================================
- Coverage   36.26%   36.15%   -0.12%     
==========================================
  Files          25       25              
  Lines        2647     2650       +3     
==========================================
- Hits          960      958       -2     
- Misses       1555     1559       +4     
- Partials      132      133       +1     
Impacted Files Coverage Δ
pkg/sfu/datachannel.go 30.76% <0.00%> (-2.57%) :arrow_down:
pkg/sfu/subscriber.go 58.22% <0.00%> (-0.75%) :arrow_down:
pkg/sfu/router.go 46.82% <0.00%> (-1.16%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d7b670b...253755f. Read the comment docs.

codecov[bot] avatar Aug 22 '21 17:08 codecov[bot]

Hey @tmiv sorry for late response, but is necessary to put the callback on the datachannel?, should Peer be a better location for a close callback?

OrlandoCo avatar Aug 31 '21 02:08 OrlandoCo

No @OrlandoCo, I don't think so. It's the middleware who should process the disconnect (onRemovePeer). Just as the middleware processes the messages (onMessage). But I think that I might be convoluting the concept of a dc middleware here. It seems that data channel can have more than one middleware thus the DC chain structure. Also, that the concept of a middleware is really just a single function.

tmiv avatar Aug 31 '21 04:08 tmiv