Radiicall / jellyfin-rpc

Displays the content you're currently watching on Discord!
GNU General Public License v3.0
211 stars 12 forks source link

Error: Couldn't connect to the Discord IPC socket #80

Closed ghost closed 10 months ago

ghost commented 10 months ago

Is there an existing issue for this?

What went wrong?

No matter what, Jellyfin-RPC will not connect to the Discord IPC socket.

Terminal output

Nov 11 22:11:18 lance-laptop jellyfin-rpc[213818]: Jellyfin-RPC Nov 11 22:11:18 lance-laptop jellyfin-rpc[213818]: ------------------------------------------------------------------ Nov 11 22:11:18 lance-laptop jellyfin-rpc[213818]: Attempt 1: Trying to connect Nov 11 22:11:18 lance-laptop jellyfin-rpc[213818]: Failed to connect, retrying soon Nov 11 22:11:18 lance-laptop jellyfin-rpc[213818]: Error: Couldn't connect to the Discord IPC socket Nov 11 22:11:19 lance-laptop jellyfin-rpc[213818]: Attempt 2: Trying to connect Nov 11 22:11:19 lance-laptop jellyfin-rpc[213818]: Failed to connect, retrying soon Nov 11 22:11:19 lance-laptop jellyfin-rpc[213818]: Error: Couldn't connect to the Discord IPC socket Nov 11 22:11:21 lance-laptop jellyfin-rpc[213818]: Attempt 3: Trying to connect Nov 11 22:11:21 lance-laptop jellyfin-rpc[213818]: Failed to connect, retrying soon Nov 11 22:11:21 lance-laptop jellyfin-rpc[213818]: Error: Couldn't connect to the Discord IPC socket Nov 11 22:11:25 lance-laptop jellyfin-rpc[213818]: Attempt 4: Trying to connect Nov 11 22:11:25 lance-laptop jellyfin-rpc[213818]: Failed to connect, retrying soon Nov 11 22:11:25 lance-laptop jellyfin-rpc[213818]: Error: Couldn't connect to the Discord IPC socket Nov 11 22:11:33 lance-laptop jellyfin-rpc[213818]: Attempt 5: Trying to connect Nov 11 22:11:33 lance-laptop jellyfin-rpc[213818]: Failed to connect, retrying soon Nov 11 22:11:33 lance-laptop jellyfin-rpc[213818]: Error: Couldn't connect to the Discord IPC socket Nov 11 22:11:49 lance-laptop jellyfin-rpc[213818]: Attempt 6: Trying to connect Nov 11 22:11:49 lance-laptop jellyfin-rpc[213818]: Failed to connect, retrying soon Nov 11 22:11:49 lance-laptop jellyfin-rpc[213818]: Error: Couldn't connect to the Discord IPC socket Nov 11 22:12:21 lance-laptop jellyfin-rpc[213818]: Attempt 7: Trying to connect Nov 11 22:12:21 lance-laptop jellyfin-rpc[213818]: Failed to connect, retrying soon Nov 11 22:12:21 lance-laptop jellyfin-rpc[213818]: Error: Couldn't connect to the Discord IPC socket Nov 11 22:13:25 lance-laptop jellyfin-rpc[213818]: Attempt 8: Trying to connect Nov 11 22:13:25 lance-laptop jellyfin-rpc[213818]: Failed to connect, retrying soon Nov 11 22:13:25 lance-laptop jellyfin-rpc[213818]: Error: Couldn't connect to the Discord IPC socket Nov 11 22:15:33 lance-laptop jellyfin-rpc[213818]: Attempt 9: Trying to connect Nov 11 22:15:33 lance-laptop jellyfin-rpc[213818]: Failed to connect, retrying soon Nov 11 22:15:33 lance-laptop jellyfin-rpc[213818]: Error: Couldn't connect to the Discord IPC socket Nov 11 22:19:49 lance-laptop jellyfin-rpc[213818]: Attempt 10: Trying to connect Nov 11 22:19:49 lance-laptop jellyfin-rpc[213818]: Failed to connect, retrying soon Nov 11 22:19:49 lance-laptop jellyfin-rpc[213818]: Error: Couldn't connect to the Discord IPC socket Nov 11 22:28:21 lance-laptop jellyfin-rpc[213818]: Attempt 11: Trying to connect Nov 11 22:28:21 lance-laptop jellyfin-rpc[213818]: Failed to connect, retrying soon Nov 11 22:28:21 lance-laptop jellyfin-rpc[213818]: Error: Couldn't connect to the Discord IPC socket

Jellyfin-RPC version

0.15.3

What OS are you using?

Ubuntu 22.04.3 LTS

What version is the Jellyfin server on?

10.8.12

Anything else?

Had a few issues with systemd before this that involved me needing to use machinectl to log in, but resolved those. This issue occurs after that, while running the jellyfin-rpc binary manually, and even after I've disabled UFW fully. The Jellyfin server and RPC client are on the same machine.

Radiicall commented 10 months ago

You need to have discord open on the computer running jellyfin-rpc, this doesnt really work on headless servers…

ghost commented 10 months ago

You need to have discord open on the computer running jellyfin-rpc, this doesnt really work on headless servers…

I see. Thank you

prochy-exe commented 6 months ago

@thebitwise hello, i would like to propose a solution (if you still need it lol). By using a client such as Vesktop, you can use jellyfin-rpc just fine since it uses arRPC which is an opensource reimplementation of RPC for custom discord clients. However you can also use the original client as well.

I have made a systemd file. The key for this to work is to make sure XDG_RUNTIME_DIR is defined in the env and as well the DISPLAY variable. Before running discord or vesktop we'll use Xvfb (sudo apt install xvfb) to make sure discord runs even though we dont have gui (or if you want to run it as an service)

systemd file:

[Unit]
Description=Discord
After=network.target

[Service]
Type=simple
ExecStart=/home/prochy/Documents/discord.sh
User=prochy
Restart=on-failure
Environment=DISPLAY=:99
Environment=XDG_RUNTIME_DIR=/run/user/1000
WorkingDirectory=/home/prochy/Documents

[Install]
WantedBy=multi-user.target

discord.sh:

#!/bin/sh
Xvfb -ac :99 -screen 0 640x640x24 > /dev/null 2>&1
vesktop

By making discord a service you can for example turn the service on and off using a webhook which might be useful if you don't want to be online on discord 24/7.

Obviously you need to come up with a way to run jellyfin-rpc. Imo you can just make a another systemd service and add it into discord.sh, if you server is slower (like mine) i highly suggest adding a timeout before running jellyfin-rpc so it doesn't have to do unnecessary attempts to connect to the IPC socket.

Radiicall commented 6 months ago

Obviously you need to come up with a way to run jellyfin-rpc. Imo you can just make a another systemd service and add it into discord.sh, if you server is slower (like mine) i highly suggest adding a timeout before running jellyfin-rpc so it doesn't have to do unnecessary attempts to connect to the IPC socket.

Another suggestion is to add After=discord.service (or whatever you called the discord service) to the jellyfin-rpc service file