SocketCluster / socketcluster-client

JavaScript client for SocketCluster
MIT License
293 stars 91 forks source link

The client initialization did not verify the hostname #105

Closed muei closed 6 years ago

muei commented 6 years ago
const { connect } = require('socketcluster-client')
const socket = connect({
  // hostname: 'localhost',
  port: 3333
})

In node env, the instance socket above with init no hostname, so the hostname will be undefined, but the instance will be create sucess. I don't think this is a good way, I suggest

MegaGM commented 6 years ago

It's not the best idea to throw exception here, I believe. It'd be impossible to use port without hostname option then.

MegaGM commented 6 years ago

Though probably it'd be better to use either hostname + port, or host alone. Not together. Check out the conversation https://github.com/SocketCluster/socketcluster-client/pull/110