Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client program always closing #1

Open
cache91 opened this issue Jan 3, 2018 · 5 comments
Open

client program always closing #1

cache91 opened this issue Jan 3, 2018 · 5 comments

Comments

@cache91
Copy link

cache91 commented Jan 3, 2018

I tried the example code and i find the client program always closing as soon as it start the app

@janvda
Copy link

janvda commented Oct 1, 2019

I am getting the same issue: so the connection is immediately closed when I launched the program (FYI node version = v12.6.0) you can see in next log:

Jans-MacBook-Pro:tmp jan$ node patest.js 
Connection closed
Jans-MacBook-Pro:tmp jan$ 

FYI: In order to connect to my pulseaudio server (also running on my macbook) I have made following change to the paclient code (see last 2 lines where I specified config and passed it as parameter to the connect method.

}).on('remove', (type, index) => {
  console.log(`Removed ${type}, index #${index}`);
});
config = { "host" : "127.0.0.1", "port" : 4713 };
pa.connect(config);

The following is logged by my pulseaudio server when launching the pacient program:

I: [] client.c: Created 0 "Native client (TCP/IP client from 127.0.0.1:53838)"
E: [] protocol-native.c: protocol error, kicking client
I: [] client.c: Freed 0 "Native client (TCP/IP client from 127.0.0.1:53838)"

FYI I have activated tcp protocol by uncommenting the following in file /usr/local/Cellar/pulseaudio/13.0/etc/pulse/default.pa

### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
#load-module module-esound-protocol-tcp
load-module module-native-protocol-tcp

@janvda
Copy link

janvda commented Oct 1, 2019

I have not only having this issue when connecting to pulseaudio server running locally on my macbook, but I am also having this issue when trying to connect to pulseaudio server running in docker container on a raspberry pi. The following is logged (= same error message)

30.09.19 22:27:21 (+0200)  pulseaudio-server  E: [pulseaudio] protocol-native.c: protocol error, kicking client

So the problem is not due to pulseaudio server running on my macbook.

@janvda
Copy link

janvda commented Oct 1, 2019

The protocol error logged by the pulseaudio server are triggered by the following source file (search for protocol_error)

https://gitlab.freedesktop.org/pulseaudio/pulseaudio/blob/master/src/pulsecore/protocol-native.c

@janvda
Copy link

janvda commented Oct 1, 2019

Just tested it directly on my raspberry pi (using balena application) and I am getting same problem (so in this case node.js version = v8.16.1):

node-red@ba7c427:/data$ node -v
v8.16.1
node-red@ba7c427:/data$ node patest.js 
/bin/sh: 1: xprop: not found
Connection closed
node-red@ba7c427:/data$ 

The error logged by my pulseaudio server also running in raspberry pi docker container:

01.10.19 20:12:03 (+0200)  pulseaudio-server  E: [pulseaudio] protocol-native.c: protocol error, kicking client

@webispy
Copy link

webispy commented Sep 24, 2020

FYI, please refer to my code below (tested in Mac environment.)

const PAClient = require("paclient");
const { readFileSync } = require("fs");

const pa = new PAClient();

const cookiePath = `${process.env.HOME}/.config/pulse/cookie`;
const cookie = Buffer.from(readFileSync(cookiePath, "binary"), "binary");

pa.connect({ host: "127.0.0.1", cookie: cookie });

Pulseaudio install guide:

  1. install
brew install pulseaudio
  1. change the /usr/local/opt/pulseaudio/homebrew.mxcl.pulseaudio.plist file. (insert a following line to <array>...</array>)
<string>--load=module-native-protocol-tcp</string>
  1. register to service (auto-run)
brew services start pulseaudio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants