0

I am planning a website with an html/javascript frontend input and a php backend. The user has to input data which will be saved in a database. Now I want to inform the other users of my site accordingly about the changes made on the database.

Is this possible in any way (at this point of planning I cannot say how many people will use this in the end so it has to be a user friendly option).

The concept I have is following: I type in a message like Hello then the other user should be informed about the fact that the last word was Hello so that they can add a new word like World. But the fact that some user are faster than others the word will be fastly outdated. So i have to find a solution for that.

Any suggestions or is my question unclear?

asked Aug 6, 2015 at 12:59
5
  • Is this conceptually different from a realtime chat on a website? Commented Aug 6, 2015 at 13:08
  • @Ordous hmm, thats a good point. but PHP and realtime? :D or should I use Websockets? Commented Aug 6, 2015 at 13:10
  • I honestly don't know how those things are implemented. But if it looks like something close to what you need - then the answer is an obvious "yes" with a direction to look in (even though it may not be entirely suitable or the easiest solution) Commented Aug 6, 2015 at 13:17
  • or is it a good solution to ignore the ouddated requests? so only accept the first word and ignore the following sent words for the old shown word. is this suitable for a good user experience? Commented Aug 6, 2015 at 13:20
  • That depends on what your system is. There is inherently some concurrency when multiple users do things in real time. What will you do if someone posts 0.1 seconds before a user hits "Enter"? Same thing can be done if someone posts in the 0.5 second period while you poll for the latest state. It's perfectly acceptable to just not do anything in chats. Stuff like managing something important will likely refuse the entire operation to play safe. Some will accept the update but allow you to make retroactive changes. This is more to do with UX rather than software design though. Commented Aug 6, 2015 at 13:34

1 Answer 1

1

Your best bet for this if your intended clients have sufficiently modern web browsers is Web Sockets. There are plenty of libraries out there that you can use and can look into. The one I have used most recently for PHP projects is Pusher, but searching for 'PHP websockets' turns up plenty of libraries and code samples you could use.

answered Aug 6, 2015 at 13:56
1
  • Found Fleck. What is exactly what I wanted, thanks. Commented Aug 7, 2015 at 7:41

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.