Page 1 of 1

What does Phidget22.Connection do?

Posted: Sun Feb 19, 2023 1:30 pm
by khun
I find examples like these for web pages:

function connectPhidgets() {
var local = location.hostname; //get host location
var conn = new phidget22.Connection(8080, local);
conn.connect().then(runExample);
}

What is happening here? Why would I need to do this in a web page (index.html), in python I just open the DigitalOutput without making any "connection"?

Re: What does Phidget22.Connection do?

Posted: Tue Feb 21, 2023 12:54 pm
by Patrick
From the browser, Phidgets are opened via the phidget22networkserver. The Connection object is creating a connection to the local server to access the Phidgets. Other languages have different APIs for the network connection options.

Make sure your network server is installed and running. I saw you made some other posts - if things work properly and then stop working, make sure that the network server daemon is still running, or have a look in the network server logs to see what may be wrong.

-Patrick

Re: What does Phidget22.Connection do?

Posted: Tue Feb 21, 2023 3:35 pm
by khun
Thanks for the reply.

I don't know how to check for those things, but I suddenly realized that the problem now seems to be user rights again, which I am discussing in another thread (I can't run phidget22admin without sudo).

So I'm happy with the answer here for now, I was just wondering what the "connection" was for.