andrewrk / mpd.js

Connect to a music player daemon server, send commands, emit events.
MIT License
89 stars 18 forks source link

MPD can't connect 'net.connect' is not a function #14

Closed ajbowler closed 10 years ago

ajbowler commented 10 years ago

Hi, I'm currently working on a class project that uses MPD and I'm trying to use your mpd module and am running into issues. I have the following code:

var mpd = require('mpd'); var cmd = mpd.cmd; var client = mpd.connect({port: 6600, host: 'localhost'});

And I have this code running in an HTML file just to see if I can connect to my local MPD server, but Firefox is returning 'net.connect' is not a function.

Do you have any suggestions?

andrewrk commented 10 years ago

It looks like you're trying to run code that is intended to work in a Node.js environment in the browser.

You would have to have a proxy server to make this work.

P.S. give Groove Basin a chance :) It supports the MPD protocol.

ajbowler commented 10 years ago

Thanks, I'm very, very new to Node.js and server-side code in general. After running this code in my Node terminal it works fine when my MPD is running (as it should). The project I'm working on is basically creating a webpage client for MPD with a bunch of other features so I was hoping to use an existing js MPD client to help me out.

I'll see what I can do to work around this. Thanks!

andrewrk commented 10 years ago

you might take inspiration from groove basin. Here's a live demo: http://demo.groovebasin.com/

it started as exactly what you are building, a webpage client for MPD with a bunch of other features, and then it grew into something bigger that actually replaces MPD itself.

andrewrk commented 10 years ago

good luck on your project.