Jump to content

Failure to connect on local network


notzippy
Go to solution Solved by Luke,

Recommended Posts

notzippy

I recently setup a new computer on my network and ran into the browser issue where the server could not be found. I looked into that deeper, and traced down an issue in the `emby-apiclient/connectionmanager.js` code. 

* The site `http://app.emby.media/#!/startup/selectserver.html` requests the list of servers (`https://connect.emby.media/service/servers?userId=XXXX`), and receives the correct list from the host which includes both the external URL and the local URL.

* However when the function "connectToServer" is called, the serverInfo object has the LocalAddress as Undefined. Looking further into this I see the following code in the same file

 

                    return console.log("Begin getConnectServers"),
                    credentials.ConnectAccessToken && credentials.ConnectUserId ? ajax({
                        type: "GET",
                        url: "https://connect.emby.media/service/servers?userId=".concat(credentials.ConnectUserId),
                        dataType: "json",
                        headers: {
                            "X-Application": "".concat(instance.appName(), "/").concat(instance.appVersion()),
                            "X-Connect-UserToken": credentials.ConnectAccessToken
                        }
                    }).then(function(servers) {
                        return servers.map(function(i) {
                            return {
                                ExchangeToken: i.AccessKey,
                                ConnectServerId: i.Id,
                                Id: i.SystemId,
                                Name: i.Name,
                                RemoteAddress: i.Url,
                                LocalAddress: i.LocalAddres
                            }
                        })

After the network call to get the servers is made, the response is remapped and the `LocalAddress` is assigned to `i.LocalAddres` Note the missing second `s` in `i.LocalAddres`. This I believe is a bug.

This is why on first visit a browser cannot navigate to a server on the local network. After you manually add an IP address, emby stores a cookie so the ip address is mapped properly based on the server IP so from that point forward the problem becomes mute. But initially the setup is awkward.

 

  • Like 2
Link to comment
Share on other sites

  • Solution

Hi, that's a great find, thanks ! That will be sure to help with connection problems using the hosted web app.

For the native apps, it's unlikely to matter because the local address would just end up getting filled in via local network server discovery, but since the web app can't do that, it does matter here. Thanks !

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...