add Server constructor fixed errors
add main event loop