Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

websocket failing and never reconnecting #73

Closed
heckj opened this issue May 3, 2024 · 3 comments
Closed

websocket failing and never reconnecting #73

heckj opened this issue May 3, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@heckj
Copy link
Collaborator

heckj commented May 3, 2024

Logging updates in place, and I suspect I messed up something - WebSocket connections are now failing starting to connect, then failing - and toggling the websocket off and on again isn't explicitly resetting it. So there's a miss in there, somewhere.

Logs from MeetingNotes (trace logging enabled on WebSocket):

WEBSOCKET: Activating websocket to wss://sync.automerge.org/
WEBSOCKET: SEND: JOIN[version: 1, sender: 0711B157-AAE4-4A40-8AF5-A97375338435, metadata: [storageId: nil, ephemeral: true]]
WEBSOCKET: Attempt to send a message without a connection or defined remote peer
P2PNET: Sending SYNC[documentId: 3BwAK2fZ3Nrgn9HRBb9yvNx9xXKX, sender: 0711B157-AAE4-4A40-8AF5-A97375338435, target: storage-server-sync-automerge-org, data: 334 bytes] to peer storage-server-sync-automerge-org
P2PNET: Unable to find a connection to peer storage-server-sync-automerge-org
WEBSOCKET: Peered to targetId: storage-server-sync-automerge-org PEER[version: 1, sender: storage-server-sync-automerge-org, target: 0711B157-AAE4-4A40-8AF5-A97375338435, metadata: [storageId: 3760df37-a4c6-4f66-9ecd-732039a9385d, ephemeral: false]]
WEBSOCKET: Error reading websocket: The operation couldn’t be completed. Socket is not connected

this may be an issue with the networking subsystem as well - the error P2PNET: Unable to find a connection to peer storage-server-sync-automerge-org should have found a connection. This is notably happening on iOS, with the simulator, but not on macOS, which seemed to hold a connection without issue and clearly sent sync messages upstream as text content was changed.

@heckj heckj added the bug Something isn't working label May 3, 2024
@heckj heckj self-assigned this May 3, 2024
@heckj
Copy link
Collaborator Author

heckj commented May 3, 2024

WIP to debug: #74

@heckj heckj linked a pull request May 3, 2024 that will close this issue
@heckj heckj removed a link to a pull request May 3, 2024
@heckj
Copy link
Collaborator Author

heckj commented May 3, 2024

While in #74, I found an issue where I was presuming all message send() need a PeerID in order to send, which was probably failing the connect. I broke that out into a separate logic path, and only retarget a send() message IF peerId is available, which isn't the case on the initial sends to establish handshaking. The logic is only really needed for broadcast messages from the repository (sync, ephemeral, etc)

@heckj
Copy link
Collaborator Author

heckj commented May 7, 2024

My screwed up logic was the issue - that's resolved with #74 and #75 (tracing left in place, but made "opt-in" to keep from flooding someone using this library that doesn't want that level of detail

@heckj heckj closed this as completed May 7, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant