Ask coding questions

← Back to all posts
How does pinging work?
CodingEssence

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 [earned 5 cycles]
View Answer
Voters
CodingEssence
Comments
hotnewtop
VulcanWM

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

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

Coder100

its in the db @CodingEssence

CodingEssence

@Coder100 db as in database, right?

VulcanWM

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

Coder100
CodingEssence

@Coder100 @VulcanWM ooo ok got it thanks!

Coder100
VulcanWM
IMayBeMe

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.

CodingEssence

@IMayBeMe ok thanks!