LearnBoost/socket.io — Issue #739: A really EASIST question:how to build a client page?
Author: novemrain
Created: 2012-02-06 13:26:06+00:00
State: open

I am a beginner for nodejs and socket.io, I need help

All I want now is build a server-client demo which can exchange message basicly using websocket.

For example,run 'server.js' using node.exe ,and then,open 'client.html' ,on the page,I can click a button to send "hello" to the server,then the server echo it back.

It's easy,right? I get on http://socket.io/ There is a demo which you must have seen ,here it is.

server side:
var io = require('socket.io').listen(80);

io.sockets.on('connection', function (socket) {
socket.emit('news', { hello: 'world' });
socket.on('my other event', function (data) {
console.log(data);
});
});

client side:

So,the server side is right,when I 'node' it,it comes with "socket.io started"
But the client side,what is the script? I think the client side may supposed to be 'client.html',so,it means put the 'script' into a html?I really dont know how to create a client.

Now,I wish someone can give me a server-client demo,and tell me how to build and use the demo
I am not from a English-speaking country,so wish you can make words easy to understand

Everyone can do it,right? But I did it for 5 days with nothing works..I think I really need some guidance,THANK you very much!