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 8332655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:47:11+00:00 2026-06-09T02:47:11+00:00

The idea/context: I’m thinking about giving my users a nice little extra feature: I

  • 0

The idea/context:

I’m thinking about giving my users a nice little extra feature: I want to add push notifications. This is the use case:

People have a guestbook at their profile page. When someone posts a message in a user’s guestbook, that user will receive a push notification (if he’s online ofcourse). If he’s not online, the next time he comes online, we’ll just pull the notifications from the DB.

I was thinking about doing this with Socket.IO running on a Node.JS server. My current application is built with PHP (so the posting etc. is handled by PHP).

All online users will connect using Socket.IO to listen for their own notifications. Their socket will be saved in an array or hash on the server.

This is the flow I have in mind:

  1. UserA posts a message in guestbook of UserB
  2. Make Socket.IO emit a notification to UserB (if online, so known by Socket.IO)
  3. Save the message in DB

The issue here is the ‘make Socket.IO emit a notification‘-part. I would need a way to do this from PHP, because I want the server to emit this notification and not the user that is posting the message. Why you ask? I want to prevent malicious users from creating fake notifications. So in pseudocode the PHP application would look like this:

// do some validations here ...

// This is the message that was posted
$message = array(
    'from' => 'UserA',
    'to' => 'UserB',
    'msg' => 'Hello you'
);

// Send a notification to the user by emitting an event
socketio_emit('notification', json_encode($message));

save_in_db($message);

The question(s):

What are your thoughts about this? Are there better ways to implement this seemingly small feature? And also, how would I do the socketio_emit() in PHP, in other words: how do I communicate with a Socket.IO server using PHP?

Thanks a lot!

  • 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-06-09T02:47:12+00:00Added an answer on June 9, 2026 at 2:47 am

    I solved this by using Express.js and CURL to post new notifications. The Node.js server listens to a specific URL, e.g. /new_notification. Doing a POST request from my webserver with CURL to that URL, I can add new notifications and handle them with Socket.IO (all in the same Node.js application).

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

Sidebar

Related Questions

Context I have a live running redis-server. I want to make a backup. Idea:
Idea: I want to make smth like real time electronic blackboard. Many users have
Any idea on how can I track users bookmarking event? I want to find
can any body have any idea if we can add a context menu or
I want to add a context variable in Django, so that I could define
idea I would like to create a little app for myself to store ideas
The idea of what I'm trying to do is allow a client to add
I want to create a plugin that displays additional information about Eclipse's compare results.
Just a little idea I'm playing with, not sure if it's viable or has
IntelliJ Idea 10.5.0 WebLogic Run/Debug configuration documentation mentions context dropdown. I am using 10.5.2

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.