In that case:
```sh
npm install git://
github.com/learnboost/socket.io.git
```
And if you want to be saved right away to your `package.json` then
```sh
npm install git://
github.com/learnboost/socket.io.git --save
```
And you are missing the following line in your server before anything:
```javascript
var server = require('http').Server();
```
You are making the server an `io` object, which is not the right way.
Instead the `server` must use either the `http` library or `express`
(You could even use `connect` AFAICS). Then, the server is the one
listening to a port. So server side should be:
```js
var server = require('http').Server();
var io = require('
socket.io')(server);
io.on( ... whatever ... );
server.listen(8080); // Here's where the port goes!
```
Kind regards,
On 7/19/13 8:40 PM, utan wrote:
> Yeah, but that I am using
socket.io v1, the readme is no longer valid
> since it changing a lot go to git project and you will see the new
> changes..
>
> I downloaded it using git saved in my folder project then a
socket.io
> folder was saved then cd in the folder and install it using npm install .
>
> Which supposedly installed it as per project , but when required didn't
> found the module. I then tried installing it as global npm install . -g
> and installed it find and could require it using full path..
>
> I don't know if the correct procedure installing it from git.. but
> that's why I am posting here.
>
> On Thursday, July 18, 2013 10:07:00 PM UTC-7, utan wrote:
>
> Hi,
>
> So I've installed
socket.io <
http://socket.io> v1 but I don't seem
> to get it to run properly can you guys tell me what I am doing wrong?
>
> I have so far:
>
> Server side :
>
> var io = require('/usr/local/lib/node_modules/
socket.io
> <
http://socket.io>');// installed globally but cant find nodule
>
> var server = new io(8080); // port as argument
>
> server.on('connection', function(client){
> console.log('connected to
socket.io <
http://socket.io> v1');
> client.on('event' , function(data){
> console.log(data);
> });
> });
>
> It seems to start because I can navigate to localhost:8080
>
> then in client side I have:
>
>
> var socket = new eio.Socket('ws://localhost:8080');
> socket.on('open', function () {
> console.log('connected');
> socket.on('message', function (data) {
>
> });
> socket.on('close', function () {
> console.log('disconnected');
> });
> });
>
> If I use
engine.io <
http://engine.io> the client connects fine but
> not with latest
socket.io <
http://socket.io>..