locaion.origin is better than .host
update server.js

If you want to save some data with the special connection, you can just
use socket itself. BTW socket.id is a good unique id.
ships[id] = {}; the id is actually the name, you can consider use
socket.id instead