Realtime chat service
Your client JavaScript indentation is very, very messed up. I can hardly understand what's going on.

Some lines are missing an indentation, and some have an extra indentation, or even an extra space (which is extra very messed up, because you are leaving the alignment of a tab/indentation).

Everything inside the very first function should be indented one tab. Everything inside the socket.on's second parameter should be indented another tab. Everything inside $(#button).on's first parameter should be indented another tab.

Here is your tab code cleaned up:

$(function(){
    var groupid = 2; //this groupid will change in the actual app. Right now is hardcoded. At tun time, this roupid is passed from php. 
    var socket = io("http://104.236.19.119:3000");
    socket.on('connect',function(){
        window.alert("You are connected.");
    });

    $('#button').on('click',function(){
        var entry = $("#entry").val();
        var reply_msg = {"content" : entry, "group":groupid};
        socket.emit('reply',reply_msg);
        $("#entry").val("");
    });
    var groupname = groupid + "chat";
    //got the msg and append to chat window 
    socket.on( groupname , function(data){
        var new_msg = $("&lt;p&gt;" + data.content + "&lt;/p&gt;");
        $('#msg').append(new_msg);
    });
})


This code is much, much easier to read.



$('#button').on('click',function(){
    var entry = $("#entry").val();
    var reply_msg = {"content" : entry, "group":groupid};
    socket.emit('reply',reply_msg); // &lt;--
    $("#entry").val("");
});


You have a potential error here: in this function, you attempt to send a signal to the server that you are connected to. However, if the client had not yet connected to the server, socket.emit will fail.

To fix this, create a variable called isConnected and set it to false. Then, when the first socket.on fires you can set this variable to true. That way, you can setup an if statement in the code above so that you don't try to reply to the server without first connecting to the server.

Here is what I mean:

var isConnected = false;
socket.on('connect',function(){
    window.alert("You are connected.");
    isConnected = true;
});

$('#button').on('click',function(){
    if(isConnected) {
        var entry = $("#entry").val();
        var reply_msg = {"content" : entry, "group":groupid};
        socket.emit('reply',reply_msg);
        $("#entry").val("");
    } else {
        alert("You are not connected yet.");
    }
});