Last Updated: February 25, 2016
· poupougnac
1505228 10153667646265066 1410509922 n

Using and Express 3.X on the same port

I'm using CoffeeScript. In my opinion, it should replace javascript :)

If you don't think so, you can convert that code to plain javascript here :

 First we have some dependencies :

express = require 'express'
io = require ''
http =  require 'http'

With Express 3.X you have to explicitely use http and create your server :

server = http.createServer app
io = io.listen server
io.set 'log level', 1
server.listen 80

 Now you can manage all your connections :

io.sockets.on 'connection', (socket)->
    address = socket.handshake.address
    client_ip = address.address
    socket.on 'hello',->
        socket.emit 'hello_you',
            you_are : client_ip
Say Thanks