News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

AJAX new replies notification

Started by ocmdiaz714, September 19, 2012, 09:08:41 PM

Previous topic - Next topic

ocmdiaz714

It would be great to have mod that will display a "(#) new reply(s)" notification in the bottom of a topic, when new replies have been made, and by clicking it you refresh the page and are taken to the last post made.

For example:


Thank you.

Hj Ahmad Rasyid Hj Ismail

Search for ajax in mod page. You will find something closer to that.

live627


ocmdiaz714

I actually already have enotify, is there anything like what I requested perhaps?

Hj Ahmad Rasyid Hj Ismail

Quote from: ocmdiaz714 on September 21, 2012, 02:34:49 AM
I actually already have enotify, is there anything like what I requested perhaps?
No. :P

live627

Quote from: ahrasis on September 21, 2012, 03:00:12 AM
Quote from: ocmdiaz714 on September 21, 2012, 02:34:49 AM
I actually already have enotify, is there anything like what I requested perhaps?
No. :P
Enotify is the closest ,match to what you want.

samborabora

The example posted by ocmdiaz714 two years ago is exactly what I'm looking for, are there enough existing functions in SMF that an ajax modification could be written to call this? Ie: does the database know how many unread replies the user hasn't read, so it just needs to call for the amount and display it within intervals?

Arantor

No, the database does not track that figure, it has to be calculated. The problem is, it's the second or third most expensive function in SMF *total*, meaning that recalculating it for every user every few seconds is a colossal load on the system.

Even doing it within a topic is not *especially* cheap but significantly cheaper than for the entire forum.

samborabora

Quote from: Arantor on August 31, 2014, 11:48:44 AM
No, the database does not track that figure, it has to be calculated. The problem is, it's the second or third most expensive function in SMF *total*, meaning that recalculating it for every user every few seconds is a colossal load on the system.

Even doing it within a topic is not *especially* cheap but significantly cheaper than for the entire forum.

Yeah, I expected it would be a heavy load, but as you say, within a topic wouldn't be as bad as the entire forum. How exactly does/would SMF calculate the figure on-the-fly?

Arantor

There's several ways it gets used.

Doing it from the board listing, for example, combines the highest id viewed in the topic with the highest id viewed in the board, against the last message id in the topic. Quite cheap to do.

Doing it for a topic (when new is in the URL) fetches the id from the various logs, then looks for the lowest id in the topic above that id, cross checks how many messages are in a topic before that, and that gets you the 'page' of the topic. After that it simply says 'was this message after the last one read or not' to display the new value.

In other words, SMF never bothers to count the number of unread in a topic, merely whether are any.

samborabora

Would this be a tricky mod to write, from scratch? I think it would be an amazing addition to have, and I'm not bothered about server load, at least, not at this point, if it ever became an issue, I'd cross that bridge, when and where.

Arantor

Yes and I'm not being funny but I doubt you truly understand the load involved. It is not for nothing that it is the second-or-third most expensive operation in SMF, period.

To the point where it can actually be *disabled* from the admin panel.

samborabora

Quote from: Arantor on October 03, 2014, 02:33:32 PM
Yes and I'm not being funny but I doubt you truly understand the load involved. It is not for nothing that it is the second-or-third most expensive operation in SMF, period.

To the point where it can actually be *disabled* from the admin panel.

I appreciate what you are saying, I've seen other boards use similar features, and yes, I'm sure they have their own server-farm setups so they don't run into these problems, but I literally am doing this because I get a kick out of getting these features together and working, at the moment I haven't got server load issues since I am the only one enjoying these modifications. If anyone wanted to try some of this stuff out of huge forums, I'd hope they would ensure they had the capabilities to fulfill them, I myself have no such trouble at present.

How would you begin to store the number of unread replies on a page? As I have said before, I'm used less with ajax, so I'd appreciate any assistance from someone with extensive understanding of javascript and the like, I'm just trying to figure out fundamentally how this could store and process the unread replies.

Arantor

You have two choices.

1. You recalculate it every single request.
2. You store the number and update every user who can see that board, every single time a post is made.

Both are expensive, and on busy sites, option 1 proves cheaper.

samborabora

I think you're right, there's no point storing it for everyone, just needs to be dynamically calculated on a when and where basis. Would this require deep knowledge of Ajax or could I "wing it" with a. Bit of luck and cobbling together?

lordrene

Anyone know how to get this?

Or anything similar!!!

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

1. They built it themselves.
2. They have a possibly insecure methodology of doing it, not sure yet.
3. They have multiple - expensive - servers. If I had to guess, I'd speculate they're paying over $100 a month on hosting costs for that - and a large part of that is the secondary server whole ONLY job it is to do the live updating.

lordrene

Quote from: Arantor on December 08, 2014, 07:27:33 PM
1. They built it themselves.
2. They have a possibly insecure methodology of doing it, not sure yet.
3. They have multiple - expensive - servers. If I had to guess, I'd speculate they're paying over $100 a month on hosting costs for that - and a large part of that is the secondary server whole ONLY job it is to do the live updating.
so there is no way of knowing if there is new replies to threads? At all?

Arantor

Sure there is. It's that little button up to that says 'Show new replies to your posts'. It's just not hammering the server by doing it every few seconds.

Advertisement: