Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to create a chat in php? or How to push message from server to client?

Posted on 2010-09-14
6
Medium Priority
?
921 Views
Last Modified: 2013-12-12
Hi,

I'm about to include a chat feature in my website. This chat should not be like in any other website, as providing a link like "Click here to chat". And I dont want to include any opensource chat feature.

This will contain a embedded Text Box in the webpage, where the user will directly enter the message and click submit, which will reach the administrator and the administrator will reply the user individually. This is because of, I need to validate some points while the user enters any message.

If my above statement was not clear, then my question is
How to push message from the server to the client?
0
Comment
Question by:ssuresh07
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 7

Expert Comment

by:tlovie
ID: 33679016
I don't think you can "push messages from the server to the client"  but you can create this behavior by writing some javascript to poll the server frequently, say once every 2 seconds to see if the server wants to say something to the client.
0
 
LVL 5

Accepted Solution

by:
wmadrid1 earned 1000 total points
ID: 33680192
Hi ssuresh07,

That is possible. "pus messages from the server to the client".
You can do it using sockets in PHP.
The basic idea is to make a sockets connection with each client and receive and send messages from each client.
The thing is how receive the messages in the client.

The easy way is do it with flash, here is a inetresting guide of how easily make a little chat:
http://www.kirupa.com/developer/flash8/php5sockets_flash8.htm

Other way is make the client connection with Javascript
0
 
LVL 7

Expert Comment

by:Vimal DM
ID: 33684507
Hai,

Just look at the following link

http://github.com/pubnub/pubnub-api/tree/master/php/


1) Where you need to download that source code and see the functionality that it developed

2) And update the "'YOUR-PUBLISH-KEY', 'YOUR-SUBSCRIBE-KEY'"

Thanks.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:ssuresh07
ID: 33692731
Hi wmadrid1 and vimalmaria,

your comments are looking useful, I'm checking the coding, because I'm new to this socket concept.

please post if there are any other easy way or any learning materials to understand sockets.

Thanks
0
 
LVL 27

Expert Comment

by:Lukasz Chmielewski
ID: 34738153
Hello, you can also take a look here
http://devzone.zend.com/article/1086
0
 
LVL 15

Expert Comment

by:Insoftservice
ID: 35704807
I agree with @wmadrid1

http://www.phpopenchat.org/
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question