Code Monkey home page Code Monkey logo

Comments (12)

pdyakov avatar pdyakov commented on July 4, 2024 2

I found that problem is in Advertiser class in didReceiveInvitationFromPeer handler:
let accept = mcSession.myPeerID.hashValue > peerID.hashValue
Most of the time it resolves to "false" which lead to disconnection. If I change it to "true" peers connecting successfully all the time.
@jpsim can you please review this line? Why current peerID hash should be greater then external peerID hash for accepting connection?

from peerkit.

qiulang avatar qiulang commented on July 4, 2024 1

I think the main problem with current implementation is when peers first connected then disconnected, they won't connect again. Because when after they accept the invitation, advertiser.stopAdvertising(). So I added a state property in Session and re-start advertising when disconnect.

from peerkit.

danshev avatar danshev commented on July 4, 2024

Also seeing this behavior -- any updates?

from peerkit.

jpsim avatar jpsim commented on July 4, 2024

Can you confirm that the problem is with PeerKit rather than Multipeer Connectivity? MPC itself isn't necessarily a paragon of reliability.

from peerkit.

danshev avatar danshev commented on July 4, 2024

Fair point; will investigate MPC directly.

Any guidance on @sudeepag 's question:

"Also, what is the procedure to attempt a reconnection after the connection is unsuccessful? Should I call .transceive again after creating a new Transceiver?"

from peerkit.

jpsim avatar jpsim commented on July 4, 2024

I'm not sure, I haven't touched PeerKit in a while.

from peerkit.

dkun7944 avatar dkun7944 commented on July 4, 2024

@danshev Any progress on this? I'm noticing the same issue with my own app, though I used the ConnectionManager struct from Cards Against.

from peerkit.

danshev avatar danshev commented on July 4, 2024

@dkun7944 unfortunately, I concluded it was the general unreliability of the MPC framework.

from peerkit.

ashtonmeuser avatar ashtonmeuser commented on July 4, 2024

๐Ÿ‘

from peerkit.

stevenbedrick avatar stevenbedrick commented on July 4, 2024

I ran into similar problems, and eventually traced it back to the same place that @pdyakov did... my guess is that this test might be here to prevent an Advertiser from accepting an invitation from a Browser that was running on the same device (as in the case of transceiving)? If so, it should probably be comparing the hashValue of myPeerID/peerID's displayName properties. I've made that change in my local version of PeerKit, and it seems to be helping quite a lot, but am not confident enough in my understanding of the issue to submit a pull request. @jpsim, I'd be happy to do so if my reasoning is correct.

from peerkit.

qiulang avatar qiulang commented on July 4, 2024

I believe this is to fix a problem in iOS7 https://developer.apple.com/library/content/qa/qa1869/_index.html

If you don't need to support iOS 7 you can just accept invitation.

from peerkit.

stevenbedrick avatar stevenbedrick commented on July 4, 2024

That certainly does appear to be the explanation, thanks, @qiulang!

from peerkit.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.