Webserver with Ajax and XML
|
|
Webserver with Ajax and XML
| Darklord |
May 23 2006, 17:28
|
|
Group: Members Posts: 80 Joined: 18-December 05 |
Ok, as promissed, im reporting on what i have done.
Here is the code for the prototype i have been working on, to test the concept and check some of the changes needed to implement it. The code isnt meant to be added, just for checking and commenting; it was done against the code on SourceForge cvs (public, of course). Following are some notes of implementation, covering what i have found out, done and thought about. |
|
Post
#1
|
|
![]() ![]() ![]() |
| Darklord |
May 23 2006, 18:03
|
|
Group: Members Posts: 80 Joined: 18-December 05 |
Implementation Notes, part 1
After some preliminary research on the topic of ajax, decided to start with implementing a prototype that could show some of the benefits and problems with making the webserver ajax aware; this prototype would also permit some comments that could drive the rest of the development. In this way, i decided to restrit the implementation to the stats bar, which already has several diferent changing parts (bars, value fields, etc) from several parts of emule. In my research, i found out that there are multiple frameworks already to help develop ajax aplications (being the hot thing of the moment and all); however, its still a not very mature field, and since i has also doing this as a learning exercise, i decided not to use any of those, and implement everything on my own. This means that it may not be very robust, and its reinventing the wheel, so thinking of choosing a framework to work with and reimplementing the code will probably be a necessary step. As for data transfer format: a structured format for data is necessary, so simple html or text wasnt gonna make it; there are two main choices, XML and JSON (kinda like serialized javascript), but not knowing this at the time, i went with the one most associated with ajax, XML (the X on ajaX), and glad i did. As the webserver as it was couldnt serve XML, i made the necessary changes (an ugly and imcomplete hack, the webserver needs serious refactoring); when done, it hit me with the new possibilities of this new interface: - possibility of any XML aware program being able to monitor and control emulePlus easily; this includes IM programs, IRC programs, scripts, whatever... - possibility of implementing true templates, using xml and xslt; bundling an archive of images and a xslt file, its possible to create pretty much any front end to the webserver from the browser, as heavy or lean as one wants, AND removing all the logic from the webserver, transfering it to the client browser; all the webserver gives is the data and processes the commands. |
|
Post
#2
|
|
| Darklord |
Jun 8 2006, 21:42
|
|
Group: Members Posts: 80 Joined: 18-December 05 |
Im suprised noone has commented on this:
QUOTE(Darklord @ May 23 2006, 18:03) As the webserver as it was couldnt serve XML, i made the necessary changes (an ugly and imcomplete hack, the webserver needs serious refactoring); when done, it hit me with the new possibilities of this new interface: - possibility of any XML aware program being able to monitor and control emulePlus easily; this includes IM programs, IRC programs, scripts, whatever... I think this is a very useful feature. To give a better ideia, i implemented another prototype, this time a Yahoo Widget, that can monitor eMulePlus through the XML interface. You can get it here. It needs a new executable, that has the xml login implemented, which you can get here. Implementation Notes I needed another, webserver non-related, way to test the XML interface, to show issues with it that couldnt appear working only on the webserver. Like i refered on the first post, a lot of possibilities exist, but i wanted to try working on another cool thing; the widgets are promissing and popular, so i decided to try to build a widget that could do the same as the prototype for the webserver client. Got the documentation and gave it a quick study; the widgets are javascript and xml, so it was easy to get it. Looking through the widget gallery, i found an already existing widget, Emule Stats, that did all that i intended, only getting the info from the online sig (doesnt work with eMulePlus, because of diferences in location and format). I looked through the code (its a small widget), added and changed what was needed; even reused some of the code on the template One of the issues i talked about that i had already identified was the login, a way was needed to send the session id to the application, so that it could use it in the other requests; it isnt needed with the browser, as it already has one, but essencial for other applications. I refactored the code of the webserver, moving the login procedure out of the processUrl() method and into one of its own. Then i added the rest of the code, to implement a request for login in the xml channel. The request is this: CODE
Given the way that the webserver can process both GET and POST http methods in the same way, the above GET method works. However, its recomended that a POST is used in this case (as its implemented in the widget). The widget just uses the getStats request, same as the template as it is today. Widget instructions To use the widget, you need the Yahoo Widget Engine. After each launch, the preferences window appears; configure the webserver url and password fields correctly. After, it will try to connect to the webserver, if a problem with the connection occurs, an alert dialog box will appear. If such happens, you will need to restart the widget, as i didnt include a login button This is just a prototype to show the possibilities i talked about; later i intent to add more functionality as it is implemented in the webserver. |
|
Post
#3
|
|
Darklord Webserver with Ajax and XML May 23 2006, 17:28
Darklord [b]Implementation Notes, part 2
For now, it still... May 23 2006, 18:29
Fuxie - DK When I try to open the zip file (windows integrate... May 23 2006, 19:09
Darklord When I try to open the zip file (windows integrate... May 23 2006, 19:42
Darklord [b]Implementation Notes, part 3
After the webserv... May 23 2006, 19:29
Darklord [b]Implementation Notes, part 4[/size]
I "hi... May 23 2006, 19:40
Darklord [b]Implementation Notes, part 5[/size]
Next Steps... May 23 2006, 20:10
Darklord archive with executable
Edit: this may not have w... May 23 2006, 21:44
Fuxie - DK
Which source codes is this built on? Maybe you co... May 24 2006, 05:28
Darklord
Which source codes is this built on? Maybe you co... May 24 2006, 11:15
DonGato Nice work, keep going... I would love an AJAX Web ... May 25 2006, 15:42
Fuxie - DK
No, of course not. (i dont believe that is even p... May 25 2006, 16:11
Darklord
Nice, thks for the info, gonna check it out. May 25 2006, 16:23

Darklord
Nice, thks for the info, gonna check it out.
[sn... May 25 2006, 16:43
Aw3 The thing is that the main slow down is not becaus... May 26 2006, 03:19
Darklord The thing is that the main slow down is not becaus... May 26 2006, 16:19
Darklord
Yes, like i said, the webserver need serious refa... May 26 2006, 17:02
Beltxo Hmmm... such an interesting development, implement... May 23 2006, 22:11
Fuxie - DK Test run, to check times...
Scenario:
Login -... May 24 2006, 06:45
Darklord
The numbers speak for them selves.. Ajax is on... May 24 2006, 11:35
Fuxie - DK This is how we've always tested when any speed... May 24 2006, 12:14
Darklord
This is how we've always tested when any spee... May 24 2006, 18:59
Darklord Hum, checking my copy on a P4 1.4GHz with 256 MB R... May 24 2006, 19:16
muleteer Fuxie's client is our test bench for WS perfor... May 24 2006, 19:40
Fuxie - DK Only for a few weeks more.. I'm getting new ha... May 25 2006, 06:45

Darklord Only for a few weeks more.. I'm getting new ha... May 25 2006, 11:13

Fuxie - DK Only for a few weeks more.. I'm getting new ha... May 25 2006, 11:27
Darklord
Now that i have the XML response for the upload q... May 29 2006, 20:37
Darklord Ok.
So now i know who to call then when its time ... May 24 2006, 20:14
muleteer Scary!!! :w00t: May 25 2006, 08:15
DonGato I sugest another approach:
Don't use template... May 26 2006, 18:27
Fuxie - DK Do you mean to build both templates into eMule.exe... May 26 2006, 18:31
DonGato
No, I mean to remove templates and just have stat... May 26 2006, 20:23
muleteer Whichever method we choose, I think we should also... May 26 2006, 18:36
Darklord
Its good practice to allow usage to non ajax ado... May 26 2006, 21:39
Aw3 That is also an advantage of the ajax way, since a... May 27 2006, 01:04
Darklord That is also an advantage of the ajax way, since a... May 27 2006, 09:27
Darklord Added upload list to xml requests, still havent ch... Jun 5 2006, 21:37
Fuxie - DK Please explain IN DETAIL what we're supposed t... Jun 6 2006, 15:49
Darklord
Ok.
[*] Download the [url=http://pwp.netcabo.pt/... Jun 6 2006, 16:42
Fuxie - DK
[snapback]76607[/right][/quote]You're using a... Jun 6 2006, 17:04
Darklord
Ya, havent updated that one, only the executable... Jun 6 2006, 17:16
Fuxie - DK The main problem from my PoV isn't the process... Jun 6 2006, 17:28
Darklord
Yep, and that is also one of the strong points o... Jun 6 2006, 18:20
Fuxie - DK But then,what is there to test for us?? Jun 6 2006, 18:23
Darklord
In particular in your case, two things:
[*] Compa... Jun 6 2006, 18:31
Fuxie - DK It's, from my PoV, next to impossible to compa... Jun 6 2006, 18:34
Darklord
True, to some extent, and im working on that (r... Jun 6 2006, 18:37
Fuxie - DK First click on "Transfer" after login sh... Jun 6 2006, 18:52
Darklord
Not necessarily, depends on the approach, if we g... Jun 6 2006, 18:57
Fuxie - DK Ofcource, Ajax is all or nothing...
But in the co... Jun 6 2006, 19:02
Darklord
No, thats one of the biggest mistakes that may be... Jun 6 2006, 19:06
Aw3 How does the server know what to resend? Do you ke... Jun 8 2006, 11:14
Darklord How does the server know what to resend? Do you ke... Jun 8 2006, 11:23
DonGato Well, the style will be kept but the data will be ... Jun 7 2006, 22:27
Darklord For now, im just working on the updating part, and... Jun 7 2006, 22:43
DonGato Well, some data we have from other parts of the co... Jun 8 2006, 05:37
Aw3 How does the server know what to resend? Do you ke... Jun 8 2006, 23:45
Darklord
Where did i said that?
What i did say was, what ... Jun 9 2006, 00:24
Aw3 It's pretty hard to find the boundary between ... Jun 9 2006, 01:11
DonGato So is better to do the localization on every call ... Jun 9 2006, 04:47
Darklord
Actualy, thats pretty much what JSON is, and its... Jun 9 2006, 08:08
Darklord As i have been told i have no suport from the eMul... Jul 29 2006, 13:16![]() ![]() ![]() |
| Lo-Fi Version | Time is now: 24th May 2013 - 06:46 |