jamulussoftware / jamulus

Jamulus enables musicians to perform real-time jam sessions over the internet.
https://jamulus.io
Other
997 stars 222 forks source link

Extend PHP code to deliver JSON server status #670

Closed pljones closed 3 years ago

pljones commented 3 years ago

In a similar manner to Tony Mountifield's server list PHP Jamulus UDP Protocol support, it would be useful for web site developers to be able to query a local server for information.

An initial set would be:

Connection details would be minimal and represent what could be seen when connected as a Jamulus client.

(It'll be a while before I get to this if someone else wants to grab it. My PHP is rusty, too...)

dzpex commented 3 years ago

I'm able to help you but i do not understand how work the jamulus protocol for capture some information. I wrote a python program that are able to start or stop a jamulus server in a specified port and return the status of the server at a php client. I wrote this for managing a remote cloud private jamulus server and start or stop it with a PHP - Boostrap GUI.

I'm happy to collaborate...if is possible.

pljones commented 3 years ago

The best starting points:

The aim is ideally to have a very simple, clean PHP library that only reproduces the protocol layer, with nothing else. That can then be used for other things by who ever wants to use it.

On top of that, separately, would be built the status tool.

interogativ commented 3 years ago

You can check out the javascript in the page loaded at jamulus.muziguide.com it queries a table maintained by our server every 10 seconds. I also have a python script available that queries jamulus as a client would to build that table.

pljones commented 3 years ago

Just commenting, partly as I'm starting to think about this again and I want to organise my thoughts...

638 was aiming to remove --htmlstatus but it has been kept as JavaScript and UDP don't mix.

This ticket was raised mainly to provide similar display in a browser, based on a backend query (e.g. in PHP or python), using the same mechanism the client does when querying for servers on the connection page - but limited to a single server.

There are a number of benefits of this, the main one being that the existing flat file "goes stale" if the server crashes: it will continue to indicate there are connections, as nothing is writing to it. So an active probe will provide a more reliable monitoring facility.

As noted on the initial post, additional information above the existing html status file would be useful.

pljones commented 3 years ago

And... Tony's PHP already returns pretty much everything possibly needed: https://explorer.jamulus.io/servers.php?server=62.113.206.102

[
  {
    "index": 0,
    "name": "62.113.206.102",
    "numip": 1047645798,
    "ip": "62.113.206.102",
    "port": 22124,
    "ping": 12,
    "os": "Linux",
    "version": "3.6.1git",
    "versionsort": "003006001git",
    "nclients": 9,
    "clients": [
      { "chanid": 0, "country": "Italy", "instrument": "Vocal", "skill": "-", "name": "Alberinda", "city": "milano" },
      { "chanid": 1, "country": "Germany", "instrument": "Vocal Tenor", "skill": "-", "name": "Karli", "city": "" },
      { "chanid": 2, "country": "Canada", "instrument": "-", "skill": "-", "name": "No Name", "city": "" },
      { "chanid": 3, "country": "Spain", "instrument": "Bass Guitar", "skill": "Intermediate", "name": "oscar", "city": "" },
      { "chanid": 4, "country": "Germany", "instrument": "Keyboard", "skill": "Intermediate", "name": "Schmidty", "city": "Düren" },
      { "chanid": 5, "country": "Germany", "instrument": "Vocal Tenor", "skill": "-", "name": "Rainer", "city": "Heilbronn" },
      { "chanid": 7, "country": "Germany", "instrument": "Drum Set", "skill": "Expert", "name": "Schlumpf", "city": "" },
      { "chanid": 9, "country": "Netherlands", "instrument": "Keyboard", "skill": "Expert", "name": "Bill", "city": "Deventer" },
      { "chanid": 15, "country": "Germany", "instrument": "-", "skill": "-", "name": "Valerie", "city": "" }
    ]
  }
]

The only odd thing being name seems to be whatever value was passed as server, rather than the server name... I've raised https://github.com/softins/jamulus-php/issues/2 for that.

corrados commented 3 years ago

Extend PHP code

I must admit that I do not really understand this. Which Jamulus PHP code you are referring to? Or do you referring to a PHP code in another repo?

pljones commented 3 years ago

I must admit that I do not really understand this. Which Jamulus PHP code you are referring to? Or do you referring to a PHP code in another repo?

I think it's likely going to end up in https://github.com/softins/jamulus-php rather than here, so I'll close.