Warning: preg_replace_callback(): Requires argument 2, '$func['entity_fix']('\2')', to be a valid callback in /nfs/c01/h06/mnt/10927/domains/dragonprime.net/html/Sources/Load.php(225) : runtime-created function on line 3
AJAX based chat
DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • September 20, 2019, 02:51:55 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: 1 2 [3] 4 5 ... 11   Go Down
  Print  
Author Topic: AJAX based chat  (Read 69265 times)
0 Members and 1 Guest are viewing this topic.
Torne
SVN Users
Codemeister
*
Offline Offline

Posts: 259


Code ninja


View Profile
« Reply #30 on: September 21, 2006, 02:45:20 AM »

The current version is not a server-push, as that would result in something that would hold threads open far too long, and would ause memory problems.
Keeping HTTP connections open is not that expensive on modern web servers (unless you still use a preforking apache), and having a minimal php script running that knows only how to fetch commentary from the db and nothing else shouldn't take up that much memory.

A number of server-push AJAX systems I've seen actually use a dedicated server for the push component which is not even a full httpd - a trivial socket server attached directly to a db backend is sufficient. Smiley

Logged
edmund
Member
Militia
**
Offline Offline

Posts: 23



View Profile
« Reply #31 on: September 21, 2006, 03:58:26 PM »

The current version is not a server-push, as that would result in something that would hold threads open far too long, and would ause memory problems.
Keeping HTTP connections open is not that expensive on modern web servers (unless you still use a preforking apache), and having a minimal php script running that knows only how to fetch commentary from the db and nothing else shouldn't take up that much memory.

A number of server-push AJAX systems I've seen actually use a dedicated server for the push component which is not even a full httpd - a trivial socket server attached directly to a db backend is sufficient. Smiley



Yes, and how many LoGD admins you think will be able to do that, I have considering seting up a dedicated server for push component on HL, but we have our own server, we can do that.

Still if you have a hundred people connected to a push method, then that's a hundred sockets, and therefore a hundred threads you have open simultaneously. fetching opens and closes those threads cleanly.
Logged
kickme
Global Moderator
Mod God
*****
Offline Offline

Posts: 1589


Yay for elephants!


View Profile WWW
« Reply #32 on: September 21, 2006, 09:03:58 PM »

Not sure if you know this all ready, but some special characters don't work.
Logged

Waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka
edmund
Member
Militia
**
Offline Offline

Posts: 23



View Profile
« Reply #33 on: September 21, 2006, 09:52:02 PM »

Not sure if you know this all ready, but some special characters don't work.

Noticed that actually, was going to look into doing str-replaces in the original source to try to resolve those, but I'm not sure what I can do for it that will make those special characters transfer well, there's so many of them.
Logged
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #34 on: September 21, 2006, 10:15:55 PM »

Maybe you can do something by using "htmlentities()" ? The entity scheme is stored in the database as a setting since v1.1.0 Smiley
Logged

Running for more than three years now:
Torne
SVN Users
Codemeister
*
Offline Offline

Posts: 259


Code ninja


View Profile
« Reply #35 on: September 22, 2006, 03:38:11 AM »

Still if you have a hundred people connected to a push method, then that's a hundred sockets, and therefore a hundred threads you have open simultaneously. fetching opens and closes those threads cleanly.
A hundred threads is hardly a lot - any threaded apache run by a moderate sized hoster would have hundreds, maybe a thousand or two threads under normal operation. My webserver at home runs with thirty or forty and it's mostly only used by me Smiley

A dedicated push server app wouldn't need a thread for each socket, also; one is enough.
Logged
Ernesto
Captain of the Guard
***
Offline Offline

Posts: 115


View Profile WWW
« Reply #36 on: November 01, 2006, 12:36:38 PM »

Any updates on this one my man? If nothing ready for full release, I wouldn't mind test driving it for you.
Logged

SaucyWench
Mod God
*****
Offline Offline

Posts: 2238


I'm a good girl.


View Profile WWW
« Reply #37 on: November 01, 2006, 04:19:52 PM »

I have it installed on Darton. It shows all colours in the chat area, but the preview currently only supports the 1.0.6 colours (Edmund has been very busy lately, but I daresay he will update the modified commentary file to include the 1.1.1 colour set when he has time). It is ALSO not suitable for games with either multiple cities or clans*.








*Technically speaking there is no harm for multiple city games, but there is the potential for code-brained players to formulate an exploit enabling them to see into other chat areas in the game (excluding the Grotto), which means that they could, if so inclined, read other clan halls.
Logged

SaucyWench
Owner of GemDust.com and Darton City proudly hosted by LunarPages
Ernesto
Captain of the Guard
***
Offline Offline

Posts: 115


View Profile WWW
« Reply #38 on: November 02, 2006, 10:29:30 AM »

Ok, I am so far running this module without any problems, I just had to bugfix 3 things in the code to make it work on my server (Was some absolute filepaths that were wrong).

If we (read: edmund!) can get this working real smooth, I don't see a reason why we cant implement this type of controls in numerous places of the game. Forest fights, real time player fighting etc comes to mind. I dont know the technical backdraws of course, since I am a newbie, but setting something like this into the forest fights would be really nice, instead of having to reload "the entire page" each time you wish to execute a round.

Another example where something like this could be used is for example the potion modules. As it is now, when you quaff a potion, it reloads to a new page, where it sais something like: "Ah, you drank a potion" and then you can press the "Return to whence you came" link in the navbar, but with an ajax driven {content} it would be possible to just scroll that text in the "special window" assigned for texts and events like theese.

IE, something like this:

Quote
Box area with the static description of the location
Blah blah you are standing in a nice pretty meadow, birds are singing and an old man is scratching his hairy behind.
Just behind the man you see a gigantic tree with apples in it!
Quote
If the module does not have ajax hook support, it would output its text here in this "box" just like it always has
Quote
Ajax driven "dynamic" content, like quaffing potions, combat text, NPC chat etc
You take a bite from one of the apples. That is delicious, but the man looks at you angrily and exclaims:
"Stop that you scroundler!"
Man slaps you in the face
You take 1 damage
Quote
Box footer area with static footer description, for example "Who is here:"
Who is here
============
Players: Page Samwise, Squire Longshanks, King Robert
NPC: Old man
 
« Last Edit: November 02, 2006, 10:31:01 AM by Ernesto » Logged

GenmaC
Codemeister
****
Offline Offline

Posts: 430

Coder


View Profile WWW
« Reply #39 on: November 06, 2006, 06:18:01 PM »

I am highly impressed with this module Smiley Very good work Smiley
Logged



Castle Siege - a work in progress
Malchior
Guest
« Reply #40 on: November 06, 2006, 06:46:23 PM »

I am highly impressed with this module Smiley Very good work Smiley

I totally agree with you. But there's one thing, it somehow changes a persons clan status color to blue. But it doesn't matter anyway.  Grin Nice job Edmund Wink
« Last Edit: November 06, 2006, 07:00:44 PM by Malchior » Logged
Ernesto
Captain of the Guard
***
Offline Offline

Posts: 115


View Profile WWW
« Reply #41 on: November 08, 2006, 03:12:42 PM »

This module is absolutelly awesome, but it generates ALOT of PHP errors in the webservers errors.log file. (Undefined variables)

My errors.log file was at 7gb (Ieeek!) and this little bugger surelly didn't help to decrease the size =)
Logged

GenmaC
Codemeister
****
Offline Offline

Posts: 430

Coder


View Profile WWW
« Reply #42 on: November 13, 2006, 08:22:53 AM »

Here are a couple of the undefined variable errors I've seen and not been able to puzzle out (there was another one but it was easy to fix):

PHP Notice: "Undefined index: lastcommentid"
in /home/.ramone/mcounts/mcounts.thesevens.net/ajaxcommentary.php at 39.
PHP Notice: "Undefined offset: 25"
in /home/.ramone/mcounts/mcounts.thesevens.net/ajaxcommentary.php at 203.

I think the offset 25 error might have something to do with the color limits, as that is what mine is set to.

Also, it does not handle special characters correctly, but turns them into their ASCII code equivalent.

And lastly, the coolest thing in the world would be if I could turn this off for certain areas (like the MOTD).

ps best module ever
Logged



Castle Siege - a work in progress
Ernesto
Captain of the Guard
***
Offline Offline

Posts: 115


View Profile WWW
« Reply #43 on: November 13, 2006, 09:26:03 AM »

I am thinking that one should toss in a html_entity_decode() (PHP Manual) somewhere in there? (Or some other equivialent function)

Code:
function ajaxpostcomment () {
s = $("commentary").value;
postcontents = "lastid="+lastcommentid+"&mode=addcomment&insertcommentary="+window.escape(s)+"&section='.urlencode($args['section']).'&talkline='.urlencode($args['talkline']).'&schema='.urlencode($args['schema']).'"
var request = new Ajax.Request(
"ajaxcommentary.php",
{
method: "post",
postBody: postcontents,
onSuccess: ajaxpostsuccess,
onFailure: ajaxpostfail
});
return false;
}
Logged

Ernesto
Captain of the Guard
***
Offline Offline

Posts: 115


View Profile WWW
« Reply #44 on: November 13, 2006, 09:29:14 AM »

On the urlencode subject, there is a post menioning problems with urlencode and JavaScript escape functions, which can render content impossible to deencode using the php deencode functions.

A workaround is suggested to be
Logged

Pages: 1 2 [3] 4 5 ... 11   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Welcome to DragonPrime - The LoGD Resource Community!

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
61 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search