Ask coding questions

← Back to all posts
How does pinging work?
CodingEssence (132)

This question randomly came to me, but how does the pinging system work in replit? (Not that I'm trying to steal your idea, I don't do JS)

Answered by Coder100 (18917) [earned 5 cycles]
View Answer
Comments
hotnewtop
VulcanWM (2901)

idk how replit does it but in my social media website, i check each word to see if it starts with @, then I remove the @ from the word. If the word is a real user's username, I give them a notification

CodingEssence (132)

@VulcanWM I know how that works, but how does the ping actually go to the pinged persons notifications?

CodingEssence (132)

@Coder100 db as in database, right?

VulcanWM (2901)

Yeah as the the notifications are saved in a database replit can control @CodingEssence

IMayBeMe (548)

Pinging works almost identically to messaging. Each user should have a database key and when the code detects an @ it takes the target username and puts a notification under that database key.