Jump to content

Recommended Posts

You should use websocket for a chat, constant polling php is too much usage for the server.

 

http://socket.io/get-started/chat/

http://tutorialzine.com/2014/03/nodejs-private-webchat/

http://www.sanwebe.com/2013/05/chat-using-websocket-php-socket

 

You can search for others, this is the basic idea.

Yes, pretty much any real-time chat system is going to use TCP sockets. With a TCP connection, a client connects to a server and the connection remains open, or, "persistent". Data is more-or-less only sent one way or the other when something happens, like when a chat message is sent. If you do not use a persistent connection, and instead rely on polling, then you have to request data at continuous intervals even if there is no data to give. In such a system the messages will not be in real time, either, and will only be received when the client asks for them.

 

Now, if there is not going to be a web component then there is no point using WebSockets. You're better off just using straight up TCP protocol if you don't need web chat. And I wouldn't use PHP either, it's not really good at that. Java or NodeJS would be better choices.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.