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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:31:52+00:00 2026-05-27T00:31:52+00:00

Im trying to build a simple faye realtime based notification system so I can

  • 0

Im trying to build a simple faye realtime based notification system so I can execute a certain javascript on certain actions.The idea is relatively simple though Im having problems implementing it, not sure wich road to take on this after reading the documentation of faye.

Current thoughts are

  • One unique faye channel per logged-in user, so you can push a action (popup, set text) to a certain user only
  • One div in my app layout that I can write text to
  • One div in my app that holds layout for a popup

Now I’ve seen the railscast tutorial about faye but ryan works from a controller/action method create. I don’t want to insert stuff in the db, just call the JS function from anywhere ( building an application helper would be a good idea I think ), I would just want to do something like “execute javascript ‘set_text'” and execute javascript ‘show_popup’

What would be the best way to build such functionality with Faye, Basically I only have to

  • Execute a javascript function on a certain Faye channel

To accomplish the popup and text message.
A bit lost on this anyone can point me in the right direction or maybe have build such functionality already? thx in advanche!

  • 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-27T00:31:52+00:00Added an answer on May 27, 2026 at 12:31 am

    On the server side, you can just do (this needs eventmachine):

    client = Faye::Client.new('http://localhost:9292/faye')
    client.publish('/notifications/1', 'alert(1);')
    

    Or via HTTP:

    message = {:channel => '/notifications/1', :data => 'alert(1);'}
    uri = URI.parse("http://localhost:9292/faye")
    Net::HTTP.post_form(uri, :message => message.to_json)
    

    Then on the client side, you can then do anything with the data.

    var client = new Faye.Client('http://localhost:9292/faye');
    client.subscribe('/notifications/1', function(data) {
      eval(data);
    });
    

    Just replace alert(1); with whatever JS you want to execute.

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

Sidebar

Related Questions

I am trying to build a simple div based popup which can be used
I'm trying to build a simple User Template system so that my users can
I'm trying to build a simple jquery plugin that can take selectors as parameters.
I am trying to build a simple calculator to learn javascript/jquery but seem to
I'm trying to build a simple user authorization system where a .txt file stores
I'm trying to build a simple help system to my software. The help system
I'm trying to build a simple Tween class in javascript. The code reads something
hey I'm trying to build this simple debugger class so i can see flash
I am trying to build a simple jQuery filter system to show and hide
I'm trying to build a simple utility for kids where they can play games

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.