• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ General Support (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Couple of Suggestions and a request for advice

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
13 posts • Page 1 of 1

Postby cdn » Fri Jul 25, 2008 12:31 pm

Having played with this beast I get more impressed as I get my head around it.

May I suggest a few things that would might help those approaching the beast for the first time ?

1) For development/testing purposes setting the timeout value to a fairly high value.

Eg. $params['timeout'] = 1000 * 60 * 60; gives a decent stay around time.

It can be a little disconcerting when testing across a couple of machines to see nicks dropping off for no apparent reason depending upon the

$params["shownotice"] = 3; // 0 = nothing, 1 = just nickname changes, 2 = connect/quit, 3 = nick + connect/quit

setting.

2) Equally setting the refresh delay to a low level when testing might hammer the server but it gets things responding quickly between machines.

$params["refresh_delay"] = 2000; // chat refresh speed in milli seconds

Finally, a question.

I'm trying to get the object to use a particular nick when the chat object is launched with

<?php $chat->printChat(); ?>

the nick is set with the following code fragment.

if ( isset($_GET['nick']) )
{
$params["nick"] = $_GET['nick']; // setup the intitial nickname
}
else
{
$params["nick"] = "guest"; // setup the intitial nickname
}

By the way isset($_GET['nick'] ) should in this scenario never return false

I'm guessing that a /rehash is required, however is it possible to force the object to perform a /rehash when it is instantiated via something in the $param array ? so that object instantiation forces a /rehash prior to calling:-

<?php $chat->printChat(); ?>

I suspect I'm missing something stupid here

I don't want to hack around inside the object and kludge something as it will break my code whenever a new release becomes available.

Any help gratefully received.
cdn
Member
 
Posts: 21
Joined: Wed Jul 23, 2008 11:53 am
Top

Postby OldWolf » Sat Jul 26, 2008 2:39 am

You cannot use get/post values anywhere in your parameters. AJAX calls will not use GET/POST so the parameter's end up empty after the initial load.
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top

Postby cdn » Sat Jul 26, 2008 7:41 am

thx for that old wolf,

So essentially a feature of AJAX type async behaviour then ?

The script then takes its behaviour from what is in private/data/cache and a /rehash simply deletes the session file from the directory and forces the object to refresh itself using the $params block ?

Looks like i have to hit Google and get my Java kit out to get a grip on this <g>

Damn it I'll get my head around this if it kills me
cdn
Member
 
Posts: 21
Joined: Wed Jul 23, 2008 11:53 am
Top

Postby cdn » Sat Jul 26, 2008 7:52 am

That explains a hack i've seen on this bulletin board that uses $_SESSION inside the object.

I don't want to fiddle with the internals of the class for obvious reasons stated in previous posts.

a little lateral thinking. Could the param block be placed into the $_SESSION array on instantiation ?
cdn
Member
 
Posts: 21
Joined: Wed Jul 23, 2008 11:53 am
Top

Postby cdn » Sat Jul 26, 2008 8:08 am

ho humm, interesting - i've just fired up the chat room object on two different machines and behaviour is exactly what i would have expected. The param block settings are honoured by both boxes.

Its been a few hours and both machines sessions have timed out. Both machines have picked up the settings given in the param block.

Does this mean that a timeout forces an implicit /rehash ?
cdn
Member
 
Posts: 21
Joined: Wed Jul 23, 2008 11:53 am
Top

Postby phpfreechat » Sat Jul 26, 2008 11:02 am

No the timeout event do not forces a global /rehash. A user timeout, only clears the user's internal data ("nickmeta").
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby cdn » Sat Jul 26, 2008 11:13 am

so on a timeout a users private/data/cache is deleted ?
cdn
Member
 
Posts: 21
Joined: Wed Jul 23, 2008 11:53 am
Top

Postby cdn » Sat Jul 26, 2008 11:16 am

what precisely does a /rehash do and how does it influence the behaviour of the object ?
cdn
Member
 
Posts: 21
Joined: Wed Jul 23, 2008 11:53 am
Top

Postby phpfreechat » Sat Jul 26, 2008 11:17 am

No data/private/cache/* files are those which are deleted when a /rehash is done.
User's data are stored in data/private/chat/...
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby phpfreechat » Sat Jul 26, 2008 11:19 am

OldWolf wrote some doc about it, please read it: http://www.phpfreechat.net/rehash
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top

Postby cdn » Sat Jul 26, 2008 11:33 am

kerphi wrote:No data/private/cache/* files are those which are deleted when a /rehash is done.
User's data are stored in data/private/chat/...

Does this imply in a shared netcafe type environment one has to delete all files in

data/private/cache/*

and

data/private/chat/*

when firing up a new user ?
cdn
Member
 
Posts: 21
Joined: Wed Jul 23, 2008 11:53 am
Top

Postby cdn » Sat Jul 26, 2008 11:36 am

the session id relates to the ip not the user ?
cdn
Member
 
Posts: 21
Joined: Wed Jul 23, 2008 11:53 am
Top

Postby phpfreechat » Sat Jul 26, 2008 12:10 pm

The /rehash command will clear the cached parameters list. The corresponding file will be deleted in data/private/cache/
Most of the time you don't have to care about where the cached data are stored, you just have to know how to run the /rehash command.

The user timeout thing has nothing to do with rehash thing. When a user is timouted, his internals data are removed (stored somewhere in data/private/chat/ directory) but you also don't have to care about this because the user's internal data will be populated again at next AJAX call. In fact the timeout parameter is a way to know if the user quits the chat by closing his window, or by closing his network connection. Without timeout there is no technical way to know if a user left for these reasons.
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top


Post a reply
13 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 30 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
cron
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub