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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:17:40+00:00 2026-06-14T07:17:40+00:00

Im fairly new to NodeJS(using c9.io) and have this sick obsession with it lately.

  • 0

Im fairly new to NodeJS(using c9.io) and have this sick obsession with it lately.

I would like to know while using NodeJS. Is it possible to stream the contents of a basic html page, not large, and not special to lets say 10 concurrent users. However if there is a change to that html page the users will instantly see the changes. This can be based on whatever event but basically on the file contents being updated. Im really hoping to create some simple prototype to impress the boss and do it with NodeJS with hopes to get ride of our current out-dated use of setInterval ajax posts. puke

  1. What is the name of this process because i keep hearing different names.
  2. Is it Possible?
  3. What else would i need in addition to NodeJS
  4. Where is a good starting point?

Thanks

  • 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-14T07:17:41+00:00Added an answer on June 14, 2026 at 7:17 am

    Ok, here is a really simple example.
    A textarea synchronizes with login members.

    Please install http, socket.io and express(ver3).

    sudo npm install http, socket.io, express
    

    And create a javascript file.

    server.js

    var app = require('express')(), 
      server = require('http').createServer(app), 
      io = require('socket.io').listen(server),
      member_sockets = {},
      key;
    
    server.listen(80);
    
    app.get('/', function (req, res) {
      res.sendfile(__dirname + '/index.html');
    });
    
    io.sockets.on('connection', function (socket) {
      var user_id = socket.id;
    
      member_sockets[user_id] = socket;
      console.log("[login]-->", user_id);
    
      socket.on('txt_change', function (data) {
        for (key in member_sockets) {
          if (key != user_id) {
            member_sockets[key].emit("txt_change", data);
          }
        };
      });
    
    
      socket.on('disconnect', function (socket) {
        console.log("[logout]-->", user_id);
        delete member_sockets[user_id];
      });
    });
    

    In the same directory, you also create an index.html file.

    index.html

    <!DOCTYPE html>
    <html>
      <head>
        <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
        <script src="/socket.io/socket.io.js"></script>
        <script>
          var socket = io.connect('http://localhost');
          socket.on('txt_change', function (data) {
            console.log(data);
            $("#txt").val(data.txt);
          });
          $(document).ready(function(){
            $("#txt").keyup(function(){
              socket.emit('txt_change', { "txt" : $(this).val() });
            });
          });
        </script>
      </head>
      <body>
        <textarea id="txt" style="width:200px;height:100px"></textarea>
      </body>
    </html>
    

    Then run the server with this command:

    sudo node server.js
    

    So the code should work like this picture:
    enter image description here

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

Sidebar

Related Questions

In fairly new to MVC and I would like to use a session. I
I am fairly new to php and have not figured out how I would
I am learning LINQ and this seems like a fairly simple problem. I have
Fairly new to wpf, using the galasoft mvvm templates. I have two relaycommands that
I am new to fairly new to AS3 and I have found myself needing
I'm fairly new to ruby and I've got a hash that looks like so:
I am fairly new to php and mysql but I have created a small
Fairly new to Jquery here.... but one thing I have been told and being
Fairly new to mysql, and I am lost at the moment. This is my
I am fairly new to NodeJS and to JavaScript in general. Here is my

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.