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

The Archive Base Latest Questions

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

I am running a LAMP server on a VPS, and I have just installed

  • 0

I am running a LAMP server on a VPS, and I have just installed socket.IO on it (with node 0.6.6 as npm refused to install on 0.7.0-pre).
Now, I would like to test my installation with a simple example, such as a simple chat application, and also learn from it how to use it in my own apps.

There is however something strange with this. There seems to be a well-known 10-line chat example, but it has vanished from the developer’s website and despite hundreds of references to it and hours or searching, I fail to find the actual example.

Hidden in the page source on http://socket.io I find a screenshot of an improved version with nicknames, still in 10 lines, but alas still no code example and it’s also not public. The last example on http://howtonode.org/websockets-socketio looks like it already, but alas without a matching server-side script or html-page to embed it in.

Does anyone know what’s going on with this? Could anyone provide a working small example (chat or multiplayer game) to demonstrate the basics of socket.IO, that works with the current version?

Edit: from the examples at the socket.io website, I assume that I would need “broadcasting”, but it’s not clear to me at all how to build a working chat app from this (even though they claim it’s only 10 lines). :/

  • 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-27T20:04:32+00:00Added an answer on May 27, 2026 at 8:04 pm

    Firstly you would want to install express along side for this, makes life easier 🙂

    npm install express or npm -g install express if your installing globally, once installed create an app by going to your work directory and typing express sample to create a project called sample. go into the sample directory and open the app.js up with your favourite editor.

    replace the contents with the following:

    /**
     * Module dependencies.
     */    
    var express = require('express')
      , io = require('socket.io')
      , routes = require('./routes')
    
    var app = module.exports = express.createServer();
    
    // Configuration
    app.configure(function(){
      app.set('views', __dirname + '/views');
      app.set('view engine', 'jade');
      app.use(express.bodyParser());
      app.use(express.methodOverride());
      app.use(app.router);
      app.use(express.static(__dirname + '/public'));
    });
    
    app.configure('development', function(){
      app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); 
    });
    
    app.configure('production', function(){
      app.use(express.errorHandler()); 
    });
    
    // Routes
    app.get('/', routes.index);
    
    //IO Bindings
    io.sockets.on('connection',function (client){
    
        client.on('hello', function(data){
            //Client sent hello
        });
    
        //Add the rest of your event bindings here for client scopes
    });
    
    app.listen(8080);
    io.listen(app);
    
    console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
    

    And then you can modify your jade to t spit out the following html to the front page:

    <!DOCTYPE html>
    <html>
        <head>
            <script src="/socket.io/socket.io.js"></script>
            <script>
                var socket = io.connect(/*defaults to so ip:port*/);
                socket.on('connect', function (){
                    console.log("Connected");
                    socket.emit('hello', { my: 'world' });
                });
            </script>
        </head>
        <body>
             Body Here
        </body>
    </html>
    

    You just need to turn that into your templates and you should be good to go.

    • Similar: node.js socket.io simple chat
    • Advanced: http://fzysqr.com/2011/02/28/nodechat-js-using-node-js-backbone-js-socket-io-and-redis-to-make-a-real-time-chat-app/
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently installed a LAMP server running ubuntu server 11.04. I am trying
Just finished installing libevent(1.4.8), memcached(1.4.5), pear, and libmemcached(0.40) to my lamp server (running PHP
The situation is: I have one Debian Server running LAMP with one Virtual Host
I'm currently migrating my LAMP from my Windows Server to a VPS running Debian
I am running a LAMP server but now need to connect to MS SQL
I have an offline kiosk computer that will be running a LAMP web server
I'm running my own LAMP server locally. Something i need to setup? Should it
We have a number of servers running various different LAMP setups. One thing that
Running Mac OS X 10.5.8, with PHP 5.2.11 Pre-installed. Using Coda 1.6.10. I'm writing
I'm running a LAMP box with PHP running as fcgid. APC is installed and

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.