I'm currently working on writing a chat script that allows for clean, easy interaction between users on my site. I've got a working version, but it uses a fixed, user-entered time value for refreshing the frame. When it does refresh, the frame goes blank for a fraction of a second. This is to be expected, but it's a nuisance.
So I'm looking for two things.
1. Is there a way to make it refresh in a "cleaner" way? Put more simply, can I do something that will cause new messages to display as opposed to refreshing the entire frame?
2. Is there a way to automatically refresh the chat frame for all connected users when a new message is entered? This is a secondary priority, but I'm pretty sure I've seen something like this before.
Thanks,
Adam
Writing a Chat Script
Moderator: General Moderators
Re: Writing a Chat Script
You're probably looking for an AJAX solution.
This pre-made chat program looks nice: https://blueimp.net/ajax/
This pre-made chat program looks nice: https://blueimp.net/ajax/
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: Writing a Chat Script
Or you could make a Java applet which offers more advance features chief among them using SSL for secure communication. Look one Google there are examples.
Re: Writing a Chat Script
Thanks for the suggestions.
Although I may need an AJAX solution, a premade program like that isn't quire what I'm after (even though it looks really neat). I need something that I can throw into a frame at the bottom of a page with relative ease. The system I have now accomplishes that, but the refresh is problematic.
JAVA isn't quite what I'm after, either. A JAVA applet would be a bit over-the-top. I need something simple.
I'm just after a way to refresh a frame in the least obtrusive way possible. If I can refresh the frame after one of the users connected to teh database makes an input, that'd be all the better.
Although I may need an AJAX solution, a premade program like that isn't quire what I'm after (even though it looks really neat). I need something that I can throw into a frame at the bottom of a page with relative ease. The system I have now accomplishes that, but the refresh is problematic.
JAVA isn't quite what I'm after, either. A JAVA applet would be a bit over-the-top. I need something simple.
I'm just after a way to refresh a frame in the least obtrusive way possible. If I can refresh the frame after one of the users connected to teh database makes an input, that'd be all the better.
Re: Writing a Chat Script
As far as I know, there's no way to "push" information to a client. So, the only option you have is to refresh the window every X seconds and every time the user submits some information. A window refresh is pretty easy - there might be a window.refresh() or window.reload() function, but window.location() would work as well.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: Writing a Chat Script
As discussed before, one could make the server response to last for a very long time if there is nothing to update, and to response imidately if there is. This way it's almost realtimepickle wrote:As far as I know, there's no way to "push" information to a client. So, the only option you have is to refresh the window every X seconds and every time the user submits some information. A window refresh is pretty easy - there might be a window.refresh() or window.reload() function, but window.location() would work as well.
There are 10 types of people in this world, those who understand binary and those who don't