Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Website side chat

Featured Replies

Hi everyone,

For some kind of mmorpg we are creating a new website. We have a chat interface in-game which is used by administration/moderation to communicate with each other while they are in-game issuing reports, searching for hackers/rulebreakers. While they are doing this, communication with other staff members is essential. The interface used in-game uses a small table in a SQL database. New messages are send to this table and a code in the script of the game displays the new message whenever a new message is send.

We want to take this chat to the website. Because some administrators or moderators may not be available in-game, but on the website. They still require to communicate with eachother. Now before i start writing a page for this chat. I must tell that my knowledge does not go beyond PHP HTML and SQL. I was thinking that the chat would not be live on the website. The user would have to refresh the php page in order to read the new messages. I have been searching a while and came across AJAX. Can i show the info from the database live on the webpage using ajax? And if yes, how?

 

Thanks in advance.

Or you just use one of the many propitiatory chats applications. There are loads of them.

But they aren't that complicated to build and they often use AJAX or some other script for notifications.

  • Author
4 minutes ago, fisicx said:

Or you just use one of the many propitiatory chats applications. There are loads of them.

But they aren't that complicated to build and they often use AJAX or some other script for notifications.

The thing with the propitiatory chats applications is that it might be hard to implant it so it runs with the same chat as it does in-game. Otherwise it would be useless.

Ajax is the wrong technology for real-time, it's still HTTP based so the connection closes once it has completed, so you need subsequent requests to check if new data exists, such as new messages, or total online users. There are ways around this, like long polling, which leaves the connection open until new data arrives, but it also sends down headers, cookie data, etc, which causes latency. It also has to establish a new HTTP handshake every time, which again, adds latency. I would look at websockets https://blog.teamtreehouse.com/an-introduction-to-websockets.

Libraries like https://socket.io exist to help make this easier, and hosted services like https://pusher.com and https://pusher.com/chatkit are available if you don't want to handle the backend.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.