-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
call.on("close") not triggered #636
Comments
I can confirm the report of @LOKK3D. I have the same issue. Description Steps to reproduce
Expected Result Actual Result Is this intentional? |
So, how do we close the call? |
same problem here . Listen to "close" and "error" events on peer 2. nothing happened if peer 1 close call !! |
@MoradAbdelgaber, just send a signal to destroy the peer through WebSocket. |
Same problem here |
Same here! |
And same here |
and same here |
I found a way that worked for me, I'm using peerjs alongside socket.io, so when i kill the call by peer.close(), I then emit an event "close" via socket.io and the other peer will subscribe to that event with socket.on("close",()=>{}) |
yeah bro me same problem i think its a bug |
I am seeing same unexpected behavior where |
Same issue here :) |
I have a workaround solution that I answered in stackoverflow |
same issue... |
is there any workaround without websocket? |
I use the public peerjs server. I was able to manually close the peerConnections by getting them from
I also responded here: https://stackoverflow.com/questions/64651890/peerjs-close-video-call-not-firing-close-event/67404616#67404616 |
what is the conn variable here ?? |
yeah but where you are getting the peer id from to close the current disconnected peer call? |
@wilsonfurtado2000 - when you create a @rodrigomarcell - in tht example I am closing every connection associted with the given
|
Maybe I confuse this issue. my project has 2 block script , one is [connect to], one is [listen connect] when I get this issue, I only write one side 'close' event.... |
Just encountered this same issue. Any progress on this? |
I guess the messages above may help you. |
I understand there's workarounds for this. But any updates on whether this is going to be fixed? Looks like this issue has been open since 2020. |
Not sure what the real fix for this will be, but I managed to get this working with this patch. If you want to give it a try you should be able to install my patched version of
The solution involved creating a |
Not sure how this is working, but it seems to be working great. Thank you :) |
I was about to make this myself. Why don't you open a pull request for them ? Your solution works great! |
@AllanPinheiroDeLima I was just trying to make sure this is the correct solution. I assume at some point the remote |
@jonasgloning just tested this and have a couple of comments: 1- this (kind of) fixes the issue but it's not good enough in my case... it's only disconnecting when we get the ICE disconnect event, which takes a few seconds after I actually stop the MediaConnection on the sharing side. With the extra DataChannel at least we get an instant disconnect as soon as one side calls 2- I'm getting a TS build error now saying the |
This commit seems to be where |
Thanks for testing, @matallui!
You’re right, the delay is to large. So this isn’t a complete solution. Unfortunately, I won’t have the time to look into it the next few weeks. But I would merge a PR with your solution, at least in
There were some inconsistencies with the handwritten types, so I switched to autogenerating them in your linked commit. Turns out the types in the source weren’t accurate either. Fixed in 666dcd9, more type improvements 2b53de2. |
@jonasgloning thanks for the prompt response and for fixing 2). I will submit a PR soon with my fixes for 1) so we can test it in RC and we'll go from there. |
@jonasgloning PR submitted. Thanks again for all the help! |
when i calling video the peer close by self why this happend' |
## [1.4.8-rc.1](v1.4.7...v1.4.8-rc.1) (2023-02-25) ### Bug Fixes * `close` event was not triggered reliably ([#860](#860)) ([ec1d5ae](ec1d5ae)), closes [#636](#636) * **datachannel:** sending order is now preserved correctly ([18d491a](18d491a)), closes [#746](#746) * **deps:** update dependency @swc/helpers to ^0.4.0 ([a7de8b7](a7de8b7)) * **deps:** update dependency eventemitter3 to v5 ([caf01c6](caf01c6)) * **deps:** update dependency webrtc-adapter to v8 ([431f00b](431f00b)) * **npm audit:** Updates all dependencies that cause npm audit to issue a warning ([6ef5707](6ef5707))
Hello from 2023, I can't seem to get any |
What? |
Yes, this still seems to be an issue, none of the 'on' events gets triggered. Only solution is to use web sockets for now. |
Is it fixed?,or should I use just the webrtc |
I recommend https://github.com/feross/simple-peer It's less buggy |
I personally use something like:
Just have to wait few seconds to have the result. Best regards |
### Problem `MediaConnection.close()` doesn't propagate the `close` event to the remote peer. ### Solution The proposed solution uses a similar approach to the `DataConnection`, where an aux data channel is created for the connection. This way, when we `MediaConnection.close()` the data channel will be closed and the `close` signal will be propagated to the remote peer. #### Notes I was not sure if there was another cleaner way of achieving this, without the extra data channel, but this seems to work pretty well (at least until a better solution comes up). This should fix: #636 --------- Co-authored-by: Jonas Gloning <[email protected]> Closes #636, Closes #1089, Closes #1032, Closes #832, Closes #780, Closes #653
# [1.5.0-rc.1](v1.4.8-rc.1...v1.5.0-rc.1) (2023-08-14) ### Bug Fixes * **datachannel:** sending order is now preserved correctly ([#1038](#1038)) ([0fb6179](0fb6179)), closes [#746](#746) * **deps:** update dependency peerjs-js-binarypack to v1.0.2 ([7452e75](7452e75)) * **deps:** update dependency webrtc-adapter to v8.2.2 ([62402fc](62402fc)) * **deps:** update dependency webrtc-adapter to v8.2.3 ([963455e](963455e)) * **MediaConnection:** `close` event is fired on remote Peer ([0836356](0836356)), closes [#636](#636) [#1089](#1089) [#1032](#1032) [#832](#832) [#780](#780) [#653](#653) ### Features * **DataConnection:** handle close messages and flush option ([6ca38d3](6ca38d3)), closes [#982](#982) * **MediaChannel:** Add experimental `willCloseOnRemote` event to MediaConnection. ([ed84829](ed84829)) * MsgPack/Cbor serialization ([fcffbf2](fcffbf2))
🎉 This issue has been resolved in version 1.5.0-rc.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Thanks, I'll check it out!
…On Mon, 14 Aug 2023, 4:05 pm github-actions[bot], ***@***.***> wrote:
🎉 This issue has been resolved in version 1.5.0-rc.1 🎉
The release is available on:
- npm package ***@***.*** dist-tag)
<https://www.npmjs.com/package/peerjs/v/1.5.0-rc.1>
- GitHub release
<https://github.com/peers/peerjs/releases/tag/v1.5.0-rc.1>
Your *semantic-release
<https://github.com/semantic-release/semantic-release>* bot 📦🚀
—
Reply to this email directly, view it on GitHub
<#636 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQYO2F5SFKEPJYILR3ZXFYLXVIO73ANCNFSM4LSZVAAQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
# [1.5.0](v1.4.7...v1.5.0) (2023-09-03) ### Bug Fixes * **datachannel:** sending order is now preserved correctly ([#1038](#1038)) ([0fb6179](0fb6179)), closes [#746](#746) * **deps:** update dependency @swc/helpers to ^0.4.0 ([a7de8b7](a7de8b7)) * **deps:** update dependency cbor-x to v1.5.4 ([c1f04ec](c1f04ec)) * **deps:** update dependency eventemitter3 to v5 ([caf01c6](caf01c6)) * **deps:** update dependency peerjs-js-binarypack to v1.0.2 ([7452e75](7452e75)) * **deps:** update dependency webrtc-adapter to v8 ([431f00b](431f00b)) * **deps:** update dependency webrtc-adapter to v8.2.2 ([62402fc](62402fc)) * **deps:** update dependency webrtc-adapter to v8.2.3 ([963455e](963455e)) * **MediaConnection:** `close` event is fired on remote Peer ([0836356](0836356)), closes [#636](#636) [#1089](#1089) [#1032](#1032) [#832](#832) [#780](#780) [#653](#653) * **npm audit:** Updates all dependencies that cause npm audit to issue a warning ([6ef5707](6ef5707)) ### Features * `.type` property on `Error`s emitted from connections ([#1126](#1126)) ([debe7a6](debe7a6)) * `PeerError` from connections ([ad3a0cb](ad3a0cb)) * **DataConnection:** handle close messages and flush option ([6ca38d3](6ca38d3)), closes [#982](#982) * **MediaChannel:** Add experimental `willCloseOnRemote` event to MediaConnection. ([ed84829](ed84829)) * MsgPack/Cbor serialization ([fcffbf2](fcffbf2)) * MsgPack/Cbor serialization ([#1120](#1120)) ([4367256](4367256)), closes [#611](#611)
I've published the update in version I’m sorry it took so long. And I’m deeply sorry for the lack of communication on my part. Despite the correctness of the patch, it didn't work consistently across different platforms and browsers on my end. I wanted to ensure its reliability, so I advanced a long-planned E2E test suite, but I significantly underestimated the time this would take me. Months later, after setting everything up, the tests really did fail randomly. Both dde08f0 and 573d7d7, unrelated to the code of this PR, were necessary in the end – that was just a lucky guess. The code was fine all along, but there was a bug in the build process. The test suite indicates the I didn't have anything to update you with other than "blocked on something unrelated" and "should be working, isn’t for unknown reasons" and so I didn’t. However, I should have kept you updated regardless. I will strive to be better next time. |
## [1.5.2-rc.1](v1.5.1...v1.5.2-rc.1) (2023-12-03) ### Bug Fixes * `close` event was not triggered reliably ([#860](#860)) ([ec1d5ae](ec1d5ae)), closes [#636](#636) * **datachannel:** sending order is now preserved correctly ([18d491a](18d491a)), closes [#746](#746) * support Blobs nested in objects ([7956dd6](7956dd6)), closes [#1163](#1163)
Hi, i have a p2p connection and when i do call.close(), on("close",...) is triggered only on the peer that calls che close function. How can i trigger both the peers? Thank's!
The text was updated successfully, but these errors were encountered: