Node.js Real Time Chat: Inserting Data (Part 4/7)

Codecourse · 41K views · 2014 · 16:43

Open on YouTube

Web developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when asking why the server.js code from this tutorial prints nothing or why socket.io fails to start in their own setup.

Recommended by 0 people across 0 different months, 2014 to 2015.

What it is

Part 4 of a 7-part Codecourse series (originally phpacademy) on building a real-time chat app with Node.js, Socket.io and MongoDB. This lesson covers inserting chat messages into the database from the server.

What people said

Cites Wolf · 2014-06 · Stack Overflow · on “Node isn't working in console”

I'm watching some tutorials on youtube, how to make a real time chat with node.js from phpacademy [this video] channel. Now I'm in the step where I should run my server.js file in console. I'm running it in console with command node server.js When I run it, nothing happens, just a whitespace. It should output a message like "info - socket.io started". It works when I change the script to something like "console.log("worked");". Click here for an image. [LINK] MongoDB is running perfectly and had no errors till now. Any suggestions?

Cites user3537741 · 2015-01 · Stack Overflow · on “Node.js ( Socket.io not starting )”

Here is the server.js code : var mongo = require('mongodb').MongoClient, client = require('socket.io').listen(8080).sockets; Here is the response on cmd when running it using debug: C:\Users\User Name\Desktop\chat>node debug server.js < debugger listening on port 5858 connecting... ok break in C:\Users\User Name\Desktop\chat\server.js:1 1 var mongo = require('mongodb').MongoClient, 2 client = require('socket.io').listen(8080).sockets; 3 debug> There is no result/response when not using debug. I am trying the nodejs chat implementation as shown here: [this video] Expected response: socket.io started Let me know if you need any other details.

Cites Chris · 2015-07 · Stack Overflow · on “socket.io/socket.io.js stuck on (pending) - Node.js”

I'm trying to following a tutorial ( [this video] ) which tells me that I should do this.. It actually does work for him.

Cites Jeyaprakash · 2015-10 · Stack Overflow · on “In Node js, client=require('socket.io').listen(8080).sockets; is not working for me”

@Mathemats, Yes I installed node js, I am trying chat application using node as shown here: Node.js Real Time Chat: Inserting Data (Part 4/7) [this video] , I installed socket using cmd `npm install socket.io` as jfriend says below I believe In later version i wont get the text but I try running the html page using this src ` ` it gives error _socket.io.js 127.0.0 failed) net::ERR_UNS_