Conversation
|
Functional for both IPv4 and IPv6. This recovers if there are issues and appropriately displays errors / loading. The only thing I don't love.... I ran into this error: apple/swift-nio#1494. It didn't impact anything or cause issues but to get that error to go away I needed to add: It's just so unnecessary since we kind of DO want to bind to all sources. For example, tvOS with Ethernet, it would make the most sense to bind to all sources at 0.0.0.0? That's the only part of this that seems off. Otherwise, I am happy with this PR. |
|
Ran a build with this, not sure how to test though. I removed the server and it showed up as a discovered server I could add. Is it only used for that? |
For now, yes. So, if i did this correctly, it should be unnoticeable. Hopefully a little more robust but I don’t think people sit on this screen and try to crash it like I did. So mostly, does network discovery still work. This PR is more about switching packages so we can start looking at web socketing for things like Sync Play. We’re still a long ways from that point but this is a distant step 1 —— Edit: Actually, a good test is confirming this works on IPv6. I put in all the work for it but when I tested it I had to create a new IPv6 network so I have no idea if those were “normal” conditions. |
|
My network is dualstack, but it just lists it with the fqdn... is there a way to check without a packet trace to see if it was using IPv6? |
|
I think that would require putting the JF server on only the IPv6? At least, that's what I was doing to test it. What I did was, I put the server on exclusively IPV6 and did the same for my laptop with the emulator. IPv6 is frankly something I haven't really worked with a lot so I very well could have done it incorrectly to test it |
|
That's awesome! Thank you for the test! There was no reason that shouldn't have worked, but I'm so green on V6 that it's just good to have a second set of eyes. I appreciate the help! |
|
This is an amazing thing to upgrade. I've previously tried otherwise with Starscreen, NIO, or Bluesocet but gave up due to other priorities.
I actually would be more interested in this living in the SDK, like how we provide the |
|
Opened: jellyfin/jellyfin-sdk-swift#47 This PR uses my temp branch but should be a good, easy spot for testing. Almost a pure copy from here into the SDK. Everything is working as expected. This branch is purely that migration to use the SDK and also an upgrade to the UI to better reflect loading / errors. |

Summary
Resolves(?): #554
Relies on: jellyfin/jellyfin-sdk-swift#47
All of the work for this PR is done, but this branch currently uses my own branch with the ServerDiscovery changes. for the JellyfinSDK. When we have a final version of the ServerDiscovery changes, I will update this PR to use the updated 0.5.2(?) Swift SDK. For now, this version of the SDK and this PR can be used to validate the changes for the SDK changes.
The primary goal of this PR is to replace UDPBroadcast with Apple's Swift-NIO.
A secondary goal of this PR is to make the JellyfinDiscovery process more robust. None of these are huge issues but I thought I would address them while I was here:
deinitforServerDiscoverywas flaky. As a result, if you opened theConnectToServerViewthen closed it, then reopened it, JellyfinDiscovery would break until the app restarted.ProgressViewso the user could see there was something running.ServerDiscoveryResponseisIdentifiable. I changed theForEachto used\.Selfinstead to resolve this but the other route would be to make theid: serverID + addressor something like that but\.Selfwas the easiest route in case we decided we didn't want this item. Realistically, 99% of people are never going to have this issue. I only have this because I cloned my server for a Dev server / testing EFCore.New Error Message on Crash
The red "Error" is shown if there a problem then the
localizedDescriptionis shown under. In this case, Channel not ready. Swiftfin then tries again in 12 seconds per the Discovery Broadcast Timer. I was considering a version of this with a timer.With Timer (Not in PR)
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-05-06.at.15.04.50.mov
Why NIO over BlueSocket?
I've selected SwiftNIO over BlueSocket for our UDP broadcast/multicast implementation primarily because it's backed by Apple, and I have more faith that this will get updates than other packages. When I looked at Bluesocket, I was concerned that the last release was in 2021.
The usage for NIO was a little more... manual(?) than I would have liked but it looks like NIO is very granular so future usage for things like WebSocketting shouldn't be roadblocked due to lack of functionality. In my brief research, I found that SwiftNIO is described as having "excellent" WebSocket support (Thinking forward to #408). I originally did this with the
Networkpackage but I decided NIO would be good to get the ball rolling with and learning so I could potentially look at #408 down the road. Probably after #1203 since I don't really want to touch playback code until it's settled haha.