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

The Archive Base Latest Questions

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

My target: Create node.js server and client applications that will send antyhing (event, string,

  • 0

My target: Create node.js server and client applications that will send antyhing (event, string, function call) between two web browsers.

I installed and created simple server, but problems begin with creating a client. As said at http://socket.io/ I installed it by command:

npm install socket.io

but the file required in basic example:

<script src="/socket.io/socket.io.js"></script>

is not downloaded or installed. There is file named like that in /node_modules/socket.id/lib but is the same file ? I think that this is socket.io client but as module for server, not for web browser javascript right ?

How to get socket.io.js that just works and can connect to node.js server, without errors like io/socket/require is not defined etc. ?

I don’t want to create web serwer that responds to normal http requests. I want server that will hold connection and able to communicate between JS scripts in two browsers

I just can stand it, that everybody writes about node.js in form like everybody on the world has socket.io.js file in every possible direcortory. The possible duplicate:

socket.io.js not found

Starts with a function call require() that IS NOT in clean JavaScript API. So i don’t even try this sollution. Can anybody explain how to include and define io.* properly ? It is something about Express framework ? Why node.js and socket.id pages say nothing about express requirement ?

The problem is, that I need a CLIENT js library, and I don’t mean “client on server”, that my node binary server will have ability to connect to other pages/server and communicate. I mean client in HTML client page. And, if neccessary, other realted JS.

I grabbed a example from demo at http://serv1.aelag.com:8084/

/** Socket.IO 0.6.2 - Built with build.js */
/**
 * Socket.IO client
 * 
 * @author Guillermo Rauch <guillermo@learnboost.com>
 * @license The MIT license.
 * @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
 */

this.io = {
    version: '0.6.2',
...

How to get that file in normal way and not to steal from other server (maybe unstable or old version) ? And I need exaclty that file. Are there any dependencies ? Should I create it with building it “build.js” or developers did that ?

  • 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:19:49+00:00Added an answer on June 9, 2026 at 2:19 am

    You do need to add /socket.io/socket.io.js anywhere. If you have installed socket.io via npm install socket.io your application knows how to handle it. I played around with socket.io myself a few months back and this is a very simple “chat” that I came up with and it worked. So it might help you out! (I am using ExpressJS. A very helpful Node.JS framework btw)

    This is you server side application:

    var app = require('express').createServer();
    var io = require('socket.io').listen(app);
    
    app.listen(3000);
    
    app.get('/', function (req, res) {
      res.sendfile(__dirname + '/index.html');
    });
    
    io.sockets.on('connection', function (socket) {
        socket.on('news', function (data) {
            socket.emit('news', { content: data.text });
            socket.broadcast.emit('news', { content: data.text});
        });
    });
    

    This is your index.html

    <!DOCTYPE html>
    <html>
    <head>
    <title>socket test</title>
    </head>
    <body>
    <input type="text" id="Username"> <input type="text" id="Content"><input type="button" value="send" onclick="sendMessage()"><br />
    <script src="/socket.io/socket.io.js"></script>
    <script>
      var socket = io.connect('http://localhost:3000/pathtoproject');
      socket.on('news', function (data) {
        document.body.innerHTML += data.content + "<br />";
      });
      function sendMessage() {
          socket.emit('news', { text: document.getElementById('Username').value + ": " + document.getElementById('Content').value });
      }
    </script>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My target is to create a custom Date field (which should work with Doctrine).
I'm trying to create a target which matches multiple directories, but no files. Is
When I create a new WPF application in Visual Studio 2012 the platform target
I wish to create a zip archive of my target directory (${project.build.directory). using the
I have a Javascript function that accepts a list of HTML nodes, but it
Server side, I use below function (used as espressjs middleware) function objCreation(req, res, next){
I'm trying to call ajax inside beforenodedrop event, and when success, I want to
I wanted to create a 3 level dijit.Tree , like that: -root | --level1
I would like to create a single function to automate htmlwireups. Some portions of
After Python Objective-C syntax blows my mind! I'm trying to create a menu that

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.