put socket in it own file, cleaning up js a bit