Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6178501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:28:03+00:00 2026-05-24T00:28:03+00:00

I’m trying to build a view recent searches functionality into a website I have.

  • 0

I’m trying to build a “view recent searches” functionality into a website I have. Essentially, I would like to display a new recent search on the website every 5 seconds.

What is the best way to do this? I was thinking of having each page connect to my server with socket.io, then broadcast a message to all sockets every 5 seconds about new searches. On the client-side, upon receiving the message from the server on the socket, i’ll use some client-side javascript to update the recent searches part of the webpage.

Is the best way to do this? If so, how should I implement it?

I am using node.js/express.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:28:04+00:00Added an answer on May 24, 2026 at 12:28 am

    Something like this…

    var io = require('socket.io').listen(3001);
    
    // Send to Everyone
    setTimeout(function() {
      io.sockets.send('message');
    }, 5000 );
    
    // Send to Everyone on channel test123
    setTimeout(function() {
      io.sockets.emit('test123', {test: "success!"} );
    }, 5000 );
    

    (Untested, but should work. Requires Socket.IO 0.7.x or newer. Let me know how this goes =].

    Do note, however, that this is not the most optimal way of handling this. It would be best if you used events to signal your server to send new data to the client. For example, when you add new data to your database, at that time (and that time only) send new data to the client. It’s a bit silly & inefficient to check every 5 seconds when you can design around it. The whole point of Socket.IO is to push, not to poll. New technologies require a new way of thinking.

    Also, very important about displaying recent searches: These links are typically NEVER displayed for users, as they’re often too random to be useful. Top searches, maybe, but that information wouldn’t change regularly enough to warrant such a frequent refresh. In addition, most people use this technique to get their website listed for page for which they have no true content. An important thing to note is that if you allow search engines to these pages (by not blacklisting your search results pages in robots.txt), you run a VERY high risk of getting a low-quality flag from Google.

    My most sincere advice: While this may be a cool feature to have, especially for an admin console, it is utterly useless for visitors and can prove to be a detriment to your website’s SEO value by adding to Google’s index low quality content and loads of links going nowhere useful. I wouldn’t even display it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.