This is a read-only archive of the Mumble forums.

This website archives and makes accessible historical state. It receives no updates or corrections. It is provided only to keep the information accessible as-is, under their old address.

For up-to-date information please refer to the Mumble website and its linked documentation and other resources. For support please refer to one of our other community/support channels.

Jump to content

Channel/User tree via JSONP


pavelhoral
 Share

Recommended Posts

Hi guys,

I want to share a little work I've done for my clan. The situation is that our Murmur runs on private server and our clan website is on free hosting. The task was to have a list of channels and users on the website.

Hosting the website on the same machine as Murmur server is not possible. Using remote Ice is not possible as well as the freehosting doesn't have the PHP libraries... Giving access to Ice interface to the webmaster is also not a good idea.


One solution is using IFRAME, but I really hate IFRAMes ;). Plain AJAX can not be used because the website and Murmur are not in the same domain (XSS). So the next solution is to use JSONP and create a little widget for webmaster:


* First I made a small PHP script to render Mumble Tree into JSON object (http://gambler.orchitech.cz/mumble-server/channel-data.php).

* The script also handles optional 'callback' parameter so it can be used as JSONP (http://gambler.orchitech.cz/mumble-server/channel-data.php?callback=foobar).

* Next I made simple JS widget, which loads the JSON (http://gambler.orchitech.cz/mumble-tree/MumbleTree.js).

* And at last using some simple CSS you can see the result - http://gambler.orchitech.cz/mumble-tree/mumble-tree/


This takes me about 4 hours to make - I stopped when I see it does the job I want it to do. Feel free to use it or leave a comment what do you think about it. If you want the PHP file which generates the JSON I can post it here.


Keep up the good work with Mumble

Pavel



Update (6th Jul 2010): I have translated test page (http://gambler.orchitech.cz/mumble-tree/) to the English and add some additional information. It is now more project-like page with about, downloads, and installation sections

Edited by pavelhoral
Link to comment
Share on other sites

  • 1 month later...

Sorry Pavel but could you please explain this to me in layman terms?


First let me tell you about my clans situation. We have a dedicated server which runs our Murmur server 1.2.2 (Windows 2003), this server does not have PHP installed.


We also have a webserver (Linux), which is shared, this does have PHP but we were not able to install Murmur on it, as we don't have rights to install and run programme files, we have to go through cPanel and/or FTP to do anything.


So we have no viewer for our Mumble server!

Link to comment
Share on other sites

  • Administrators

All the JS script he provided needs a json-encoded tree of the channel tree.

Thus, you'll have to get the tree out of your murmur server and provide it as JSON somewhere.


He did it as he wrote: "small PHP script to render Mumble Tree into JSON object"


The JSON could be any programming language though, as long as it somehow gets the mumble channel tree.

One way would be via Ice and PHP, or Ice and python, and so on…

Link to comment
Share on other sites

Thanks kissaki, I now understand a little better, my problem is, that I take care of our clans website but I have little or no real programming knowledge, most of what I do is graphic related.


Although we have over 50 members from 22 countries, we are short on programming guys, We had a French guy that was brilliant at this sort of thing and did a lot of work on our stats pages etc. but he just dropped out of sight one day! And now we are stuck when it comes to this type of stuff, I was hoping that this would be something I could understand and try but it is beyond my capabilities :cry: I don't even know what a JSON object is. I came across this forum in my Google search whilst searching for a viewer.


If there is anyone willing to do this for us or help me to do it, we would be glad to make a small donation to your clan or favourite charity etc. If so we could maybe talk about it on our Mumble.


Thanks

Link to comment
Share on other sites

  • Administrators

You said you had a dedicated server where murmur runs but no PHP and a hoste webserver/webspace without murmur.


To help you, please give some more details on:

*is your dedicated server a root server? or just murmur?

*Would installing PHP and the Ice PHP extension as well as a webserver on the root be an option for you?

*Can you install the PHP Ice extension for your webserver?


If it's a root dedicated server you could either run murmur with ice and add a script to provide the JSON data and use the JS script above on your website (where the providing script could be PHP which would require a webserver, a java program as a standalone server, …),

or enable Ice for murmur and, if you can install php-ice on your webserver, access murmur directly from your website.


JSON is just a formatted string representing data. Just like XML and the like.

Link to comment
Share on other sites

Not sure what you mean by "root server" my understanding of a root server is a machine that has the software and data to locate name servers that contain authoritative data for the top-level domains, I'm certain that's not what you mean!


Our dedicated server is a stand-alone machine in a rack in a London data centre, it's a 3.2 Ghz dual-core and the operating system is Windows server 2003, we use it for running our murmur server but it's main use is for us to set up and run public game servers, of which we have several.


Installing PHP and the Ice PHP extension is not an option for this dedi, a webserver would just use up our gaming resources, as well as presenting several security issues.


On our webserver, we do have PHP 5 installed but I don't think we have Ice for PHP.


Does this information help?

Link to comment
Share on other sites

  • Administrators

yeah,

with root I meant full access, over the entire system.


As you will neither install php ice on the ded. server nor the webserver you could

a) run a standalone script (including server) on the ded machine (e.g. a java program with embedded jetty http server, which shouldn't really eat up much resources at all)

b) use a 3rd host to run the php ice scripts (or others) – This would result in communications: murmur data to 3rd host via Ice, 3rd host callable (JSON)/embeddable by website.


As you can't install php ice on your webserver you probably can neither install appropriate python or java packages, right? :) That's what I presumed here.

Link to comment
Share on other sites

Yeah, we have full access to the dedi via VNC and we have enough resource to run a java type applet, although I have no idea what a jetty http server is!


Our webserver is a basic package that we have with Lunapages, most of the software and scripts that they do supply, PHP, Joomla etc. we can install through the cPanel using Fantastico, they do support python but not it seems on the basic package so we are unable to install python although we do have perl installed, which I thought was simular. If any of this helps!

Link to comment
Share on other sites

  • 3 weeks later...

Hi,

somehow these replies did not end in my mailbox, so sorry for the late reaction. The easiest way is really to install Apache HTTP server with PHP on Murmur dedicated server. You mentioned two reasons why you don't want to do this:

  1. security
  2. performance

Security: You don't need to make any special configuration. You need only to place single PHP file in the document root folder. This PHP file is not including any other file and it is not processing any user input.

Performance: depends on how many request you think your server will handle. Our Murmur server is virtual server with only 256MB memory and it works just well.


If you think that these two are real issues, the only solution will be to use 3rd server (as kissaki suggested) to prepare the JSON data or use other webhosting with Ice extension.


Btw. you can find my small PHP script at http://gambler.orchitech.cz/mumble-tree/generate-json.txt . And please write back how (and if) you solved your situation as I think it is pretty common.

Edited by pavelhoral
Link to comment
Share on other sites

  • 3 weeks later...

Hi pavelhoral, that's ok, I didn't get a notification to your reply either so I'm sorry this response is late too.


Yes it's using a third server that interests me but the trouble is that I don't know enough about programming to be able to do it.


I need someone that could talk to me like an idiot to explain what and how this can be done.

Link to comment
Share on other sites

  • 4 weeks later...

I have a webserver w/root and Murmur installed. I don't want to install old versions of Ice that are compatible with Murmur.

Can someone explain exactly how to set up/placement of files for this json,jsonp,js widgit. I already have the Murmur Tree from the server but not sure what file type to save it as or where to put it.


Thanks

Link to comment
Share on other sites

Hi,

for better descrtiption I made a simple diagram:

http://gambler.orchitech.cz/diagram.png.

Diagram shows the most distributed solution with 3 separate servers (I think this is what redboy wants). For my situation server 1 and 2 are actually one machine.


As for question how to save the JSONP generating script - it is a PHP script so you have to place it under document root of your HTTP server for example as index.php. Unfortunatelly it requires a (very) little bit of knowledge of configuring a web server (enabling PHP) and PHP (enabling Ice).


Don't hesitate to write a PM to me (it will be more efficient). I am also able to write the Java version of the JSONP generator (I am a Java programmer rather than PHP). I can not guarantee my reaction time so you have to be indulgent :).

Link to comment
Share on other sites

Pavel, here is some new code that has to be entered into the generate2-json.txt,to have a secure Ice connection. Did you ever TEST with Ice 3.4.1 ? NOTE: This is for Ice 3.4.1. According to this: Ice-Mumble. On the top line:


All hosters note: local ICE connections have now been secured, without having to use Glacier, in Murmur 1.2.2. Simply use the icescret= parameter in your murmur.ini.


In generat2-json.txt file :


Find:

$communicator = Ice_initialize();

 

Add after:

$secret = array('secret'=>'My Pwd');

You must add your icesecret where^^^^ it says 'MyPwd' . This can be found/set in your Murmur.ini


Next Find:

$tree = $meta->getServer(1)->getTree();

 

And add in-line edit: after getServer(1):

->ice_context($secret)->

 

So now (after edits) the complete line should now look like this:

$tree = $meta->getServer(1)->ice_context($secret)->getTree();

 


I tested this without these 2 edits and received Uncaught Exception fatal errors.

All this worked for me. With the help of Pavelhoral and Kissaki, Thanks You.

The hardest part was to get Ice to read the tree.

My setup:

Windows 7

xampp- v- 1.7.3 Apachefriends.org

Ice- v3.4.1.msi Install Ice-ZeroC-msi


Link to Tree:


|USMC| Mumble Tree

Link to comment
Share on other sites

 Share

×
×
  • Create New...