Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Peer.disconnected isn't reliable + Peer.connect doesn't wait for it #1345

@stylehouse

Description

@stylehouse

Please, check for existing issues to avoid duplicates.

  • No similar issues found.

What happened?

I want this app to autoconnect. I think I read somewhere that Peer.connect() will gracefully wait for PeerServer to connect, then complete...
But this seems not to get to con.on'open' unless you wait for eer.on'open' before you Peer.connect().
Also, waiting for eer.on'open' by looking at eer.disconnected doesn't work as you'd expect. It isn't true when we begin.

See the three instances of eer.disconnected, two commented into the broken position in this commit:

stylehouse/jamsend@e05236e

How can we reproduce the issue?

Run my app. Shouldn't this work, off the top of your head?

What do you expected to happen?

con.on'open' happens, automatically

Environment setup

  • OS: Ubuntu 24
  • Platform: { "name": "jamsend", "version": "0.0.1", "dependencies": { "@noble/ed25519": "^2.2.3", "@sveltejs/adapter-node": "^5.2.12", "@types/express": "^5.0.3", "express": "^5.1.0", "peerjs": "^1.5.5", "socket.io": "^4.8.1", "socket.io-client": "^4.8.1" }, "devDependencies": { "@sveltejs/adapter-auto": "^6.0.1", "@sveltejs/kit": "^2.21.0", "@sveltejs/vite-plugin-svelte": "^5.0.3", "@testing-library/jest-dom": "^6.6.3", "@testing-library/svelte": "^5.2.7", "jsdom": "^26.1.0", "svelte": "^5.28.6", "svelte-check": "^4.1.7", "svelte-copy-url-button": "^1.0.6", "svelte-qrcode": "^1.0.1", "typescript": "^5.8.3", "vite": "^6.3.5", "vitest": "^3.1.3" } }
  • Browser: Chromium 138.0.7204.100

Is this a regression?

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugunconfirmednot yet verified as an issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions