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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:49:17+00:00 2026-06-08T20:49:17+00:00

Looking in to using PubNub to send real-time updates to the user’s web browser.

  • 0

Looking in to using PubNub to send real-time updates to the user’s web browser.

I looked over their website and materials. It looks like they have a few different options.

We would like to use it for sending real time updates to a web page that a user is looking at. The information is simple stuff like “You just received a message”. We are not trying ti implement a chat program or anything like that.

Is PubNub a good solution for this? If so, which version of the service should be be using?

We are running Django on a Heroku server.

Thanks so much!

  • 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-08T20:49:19+00:00Added an answer on June 8, 2026 at 8:49 pm

    PubNub Facebook Notification

    This is an example of a Facebook-like
    Window Box that notifies your user with a custom message via PubNub.
    You can send updates to your users on their Mobile Phone or Browser.
    This will show your user a notification; any notification you.

    Using PubNub allows Data Push via WebSockets, BOSH, Comet and other Mechanisms
    to be used in your application providing you the ability to send data
    AT ANY TIME directly to your users via MASS BROADCAST or
    INDIVIDUAL NOTIFICATIONS.

    Start Here: Live Demo

    Try it Now:
    http://pubnub-demo.s3.amazonaws.com/facebook-notification/index.html

    Download Source Code:
    https://github.com/pubnub/javascript/tree/master/examples/facebook-notification

    Begin here for easy copy/paste of code.
    It is very easy to get started and we recommend you start
    with the example link above before you begin.

    Setup Your Page

    First include the FBootstrap resources in order to provide the
    look and feel of the notification window.
    Add these Styles to your HTML file.

    <link href=bootstrap.css rel=stylesheet>
    <style type=text/css> body { padding-top: 60px; } </style>
    

    Data Connection Code

    Next you need to setup a PubNub Data Connection and then
    add rules for what to do with the data once it is received.

       <script src="https://pubnub.s3.amazonaws.com/pubnub-3.1.min.js"></script>
       <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-modal/2.2.6/js/bootstrap-modal.js"></script>
    
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
        <script>(function(){
    
        // PubNub (For Data Push to User)
        var pubnub = PUBNUB.init({
            subscribe_key : 'demo',
            ssl           : false
        });
    
        // Setup New Data Push Connectoin via PubNub
        pubnub.subscribe({
            restore  : true,
            channel  : 'example-user-id-1234',
            callback : show_notification
        });
    
        // Setup Alert Window
        $('#new-alert').modal({ keyboard : true });
    
        // Show the Notification Window
        function show_notification(message) {
            $('#new-alert').modal('show');
        }
    
        // Simulate Notification
        $('#simulate-notification').bind( 'mousedown', function() {
            pubnub.publish({
                channel : 'example-user-id-1234',
                message : 'alert'
            });
            return false;
        } );
    
        })();</script>
    

    Python Push Example

    Next you will want to add this python code
    to your Django or any other framework.
    You can add this to the message post code in your app.
    This will post a notification to your user.
    This specific example will cause a notification to appear
    inside the Facebook Notification page.

    pip install pubnub
    

    Python Source

    ## PubNub Setup
    import pubnub from Pubnub
    pubnub = Pubnub( 'demo', 'demo', None, False )
    
    ## Push Notice to 'example-user-id-1234'
    info = pubnub.publish({
        'channel' : 'example-user-id-1234',
        'message' : { 'your-data' : 'any-data-here' }
    })
    print(info)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking into using Lua in a web project. I can't seem to find
So looking into using memcache in my web application I am reading up about
I was looking at using data caching with database dependency for a web farmed
I'm looking into using Lucene and/or Solr to provide search in an RDBMS-powered web
We're looking at using Ruby for a client-server (non-web based) project where both the
I am looking at using Maven 3 for some web development. I know how
Looking at using a Javascript MVC framework to build a web app (without using
We are looking at using Redmine, and I've run into a bit of a
I've been looking at using session_regenerate_id in a login class which I have been
I'm looking into using JSR-303 with hibernate validator. We would like to be able

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.