refactor: move function from main.html
draw ghosts
add server side with Socko
remove old javascript