You cannot connect to an http server using web sockets. You have to connect via the ws or wss protocol.
This line of code:
var socket = io.connect("http://localhost:8080");
Is absurd and will never work. Don't believe me though, I have a working websocket server/client.