Possible bug with Plex.direct WebSockets

Server Version#: 1.21.1.3876
Player Version#: 4.47.3

This has been happening for a while now going back at least 10 server updates however I don’t think it is an issue with PMS itself but the Plex.direct service.

This issue only seems to happen when the notifications WebSocket is connected through the Plex plex.direct service, the socket never connects and always returns “WebSocket is closed before the connection is established.” when Plex connects through my server directly the WebSocket connects instantly and all messages are received fine.

I can access the Plex server fine through plex.tv and the plex.direct service and it shows the web ui fine and is usable however the WebSocket never connects when the socket tries to use the plex.direct domain no matter what domain I use to view the web ui and the socket just gets stuck an a never ending reconnection loop.

What are the minimum requirements for the WebSockets to pass all possible checks on the plex.direct servers, i.e. minimum TLS version and valid cyphers?

Any ideas of a solution are welcome :slight_smile:

EDIT: changed the question to use plex.direct instead of Plex Relay due to a misunderstanding.

I’m no expert about this, but to my understanding PlexRelay is not used by Websockets, ever.

You only need the relay if you want to make contact to the Plex server from the outside.
Websockets are the opposite: they are originated from the Plex server to the outside (to whichever URL is named in the websocket address).

I may have mixed up the Plex Relay with the plex.direct service, I assumed the relay was also part of that domain, I will update the topic title to reflect this now, in that case it is the plex.direct service that has this possible bug or if I know the minimum requirement I can check my network meets it.

The same applies there. Since the websocket connection is originated by the server, the FQDN of the server doesn’t play a role.

Thanks for the reply, I am not talking about the plex media server as I know that is working and the socket server is active and working, I am talking about the plex.direct service, something might be off with this or I need some help finding out what the requirements are for the connection to be allowed to pass through it.

The plex.direct service uses either DNS and/or servers to proxy the requests to the correct plex media server securely, if I go to my servers domain (i’ll use https://plex.example.com as an example) and Plex Web uses that domain to connect to the socket, everything works fine and the socket connects, if I go to that same domain and Plex Web uses https://1-2-3-4.somehash.plex.direct to connect to the socket server it fails every time and gets stuck in a reconnection loop, this tells me that the issue is with the plex.direct service or something within my network such as the TLS version number being wrong (I use TLS 1.3) for the plex.direct service to reject the connection.

Plex web doesn’t connect to the socket. If you define a websocket in your Plex account, it is the server which is making the socket call, not the client.

The Plex Web client through react makes a request to “wss://1-2-3-4.somehash.plex.direct:32400/:/websockets/notifications?X-Plex-Token=sometoken” this is done via the client not the server, this socket request uses the plex.direct domain most of the time and I just tested it again and it worked and connected and then after a refresh it failed again, something is going on

I have to apologize to you. Apparently I confused websockets and webhooks. :doh:
Sorry about that!
I have relayed your question though to someone more knowledgeable.

Thank you for the assistance, and that’s ok I did the same when asking the question so it is easily done, however I at least learnt something new today, I had no idea we could use Homer Simpson as an emoji :joy:

After some more testing I have found that once I reset my personal domain in the custom access url in the plex network settings, plex.direct can now connect to the socket but only when relay is disabled, if I enable relay the bug comes back and prevents the socket from connecting.

I would put this down to again the plex.direct and websockets not fully liking something in the request to my server using relay for what ever reason, a bug in the way plex.direct handles websockets itself or plex relay not not handling websockets correctly.

I say an issue with plex.direct due to relay, I am going to again assume they are somehow connected to each other but if not then this is in fact a relay bug as plex.direct handles websockets using a direct connection perfectly.

I found the issue, plex.direct and Plex Relay are both working perfectly, it was a setting on my router which had auto enabled after an update which I hadn’t seen, it prevented DOS attacks but basically rejected any consecutive requests if they happened too close together, I disabled it and allowed my firewall to take back control of the DOS protection, now the connection is back fully working and connecting, I am now marking this as solved and closing the thread

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.