p2p-media-loader icon indicating copy to clipboard operation
p2p-media-loader copied to clipboard

safari websocket

Open xiaoya2025 opened this issue 1 year ago • 3 comments

When have multiple trackers,Only the first tracker will be loaded,The rest will not load. mac safari and ios safari has this problem.

mac safari version: 17.6

source code: ` this.client = new TrackerClient({ infoHash: utf8ToUintArray(streamHash), peerId: utf8ToUintArray(peerId), announce: isSafariOrWkWebview() ? config.announceTrackers.slice(0, 1) // Safari has issues with multiple trackers : config.announceTrackers, rtcConfig: this.config.rtcConfig, });

`

modify source code:

`

this.client = new TrackerClient({ infoHash: utf8ToUintArray(streamHash), peerId: utf8ToUintArray(peerId), announce: isSafariOrWkWebview() ? config.announceTracker : config.announceTrackers, rtcConfig: this.config.rtcConfig, });

` After testing, it can be used normally even with multiple trackers. I want to know why it cannot be used normally.

xiaoya2025 avatar Sep 22 '24 14:09 xiaoya2025

Unfortunately, there is a bug in Safari: it closes WebSocket connections with large messages.

https://bugs.webkit.org/show_bug.cgi?id=228296

Fortunately, there is no this bug if only one WebSocket connection is open.

mrlika avatar Sep 23 '24 13:09 mrlika

You can find the issue:

  • https://discussions.apple.com/thread/253391452?sortBy=rank
  • https://forums.developer.apple.com/forums/thread/695769
  • https://forums.macrumors.com/threads/safari-cant-open-the-page-the-error-is-the-operation-couldnt-be-completed-no-space-left-on-device.2384934/

It is how it looks for us: telegram-cloud-photo-size-2-5451618477648503202-y

We can't reproduce the issue in the latest Safari 18 but are still testing it.

mrlika avatar Sep 26 '24 12:09 mrlika

I found that Safari will close web socket connection as default. (Ref: https://www.reddit.com/r/MacOS/comments/qna5js/safari_issue_in_monterey/)

I Google and found that 'disable websocket compression to fix macos monterey safari' but I'm not sure how can I do. I use wt-tracker as tracker

(ref: https://github.com/tilt-dev/tilt/pull/5082)

ElonJTrump avatar Oct 01 '24 10:10 ElonJTrump

Overall, this is a Safari issue. You can try disabling compression in wt-tracker using this option: https://github.com/Novage/wt-tracker/blob/1c6dc5e5b6b3f48b392e7bb77b0c12e57ab5ca76/README.md?plain=1#L62

mrlika avatar Nov 18 '24 15:11 mrlika