Trying to create a simple socket using socket.io

I am getting the error:

Port error: Could not establish connection. Receiving end does not exist.

but I can't figure out how to fix this, any help? Here's my code:

Server (app.js)

var app = require('express')(), 
    server = require('http').createServer(app), 
    io = require('socket.io').listen(server);

server.listen(8088);

//routing
app.get('/', function (req, res) {
  res.sendfile(__dirname + '/index.html');
});

io.sockets.on('connection', function (socket) {

  socket.emit('news', { hello: 'world' });

  socket.on('set nickname', function (name) {
    socket.set('nickname', name, function () { socket.emit('ready'); });
  });

  socket.on('msg', function () {

    socket.get('nickname', function (err, name) {
      console.log('Chat message by ', name);
    });

  });

});

Client (index.html)

<script src="/socket.io/socket.io.js"></script>
<script>
  var socket = io.connect('http://localhost:8088');

  socket.on('news', function (data) {
    console.log(data);
  });

  socket.on('connect', function () {
    socket.emit('set nickname', prompt('What is your nickname?'));

    socket.on('ready', function () {
      console.log('Connected !');
      socket.emit('msg', prompt('What is your message?'));
    });

  });
</script>

EDIT

I removed socket.connect() from the client but still get the same error

i have never used socket.connect() on the client side and i never saw that error, so i think that is where your error is comming from.

on the clientside

var socket = io.connect('http://localhost:8088')

should be the only thing you need to call to establish a connection, es ebohlman stated on the clientside there is no connect event, if you want to listen on that event u have to emit it yourself on the serverside.

io.sockets.on('connection',function(){
  socket.emit('connect',{...})
})

there is a simple example on the front page of http://socket.io/ which should get you started.

AFAIK, iosocket's connect event is something that gets fired on the server side when a client makes a connection, not something that gets fired on the client side when it makes a successful connection to the server. If I'm right, your client-side code should be responding to the "news" event (which it should see when the server acknowledges the connection) instead.

Try port 3000 or 5000 instead of 8088

His code looks fine.
On client side socket.on("connect") triggers when it is connected to the specified server.
It could be some port issue. Try different ports.
Here are some events on both client and server side
https://github.com/LearnBoost/socket.io/wiki/Exposed-events

These kind of errors have nothing to do with your code, so you can ignore them. They don't interfere with your code. They originate from a browser extension, usually try'ng to connect to a local file. More posts can be found for that specific error. That's how I found out!