The optional property extraHeaders will be used to add more headers to the HTTP handshake request. The properties "host" and "port" will be read from the URL. Options is an object that will be passed to net.connect() (or tls.connect() if the protocol is "wss:"). URL is a string with the format "ws://localhost:8000/chat" (the port can be omitted) Returns a new Connection object, representing a websocket client connection
The callback is a function which is automatically added to the "connection" event. It should return the resolved protocol, or empty if there is no agreement. This callback will be passed two parameters: the connection handling the handshake and the array of protocol names informed by the client, ordered by preference.
The options is an optional object that will be handed to net.createServer() to create an ordinary socket. The main object, returned by require("nodejs-websocket"). Se other examples inside the folder samples ws