implement socket io, WIP
remove trailing newlines