Comparing version 0.1.0 to 0.1.1
@@ -27,4 +27,4 @@ /* | ||
options = options || {}; | ||
mesh.host = options.host || '127.0.0.1'; | ||
mesh.port = options.port || '1234'; | ||
mesh.host = mesh.host || options.host || '127.0.0.1'; | ||
mesh.port = mesh.port || options.port || '1234'; | ||
@@ -49,2 +49,3 @@ console.log('Connecting to ' + mesh.host + ':' + mesh.port + '...'); | ||
mesh.name = function(name){ | ||
if (name.indexOf('::') != -1) throw new Error('Name cannot contain ::'); | ||
if (typeof name != 'string') return mesh; | ||
@@ -117,5 +118,11 @@ mesh.nameBuffer = name; | ||
} | ||
} else if (m == 'BNAMEACCEPT') { | ||
mesh.id = mesh.nameBuffer; | ||
console.log('ID: ' + mesh.nameBuffer); | ||
} else if (m.indexOf('BNAMEACCEPT') != -1) { | ||
var raw = m.split('::'); | ||
if (raw[1] != mesh.nameBuffer) { | ||
console.log('Server did not accept name request. Accepting server-provided ID: ' + raw[1]); | ||
} else { | ||
console.log('Server accepted name request.'); | ||
} | ||
mesh.id = raw[1]; | ||
console.log('ID: ' + mesh.id); | ||
} else { | ||
@@ -122,0 +129,0 @@ try { |
@@ -5,3 +5,3 @@ { | ||
"description": "Send messages to any nodejs process, anywhere on the Internet.", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "http://bolt.io/", | ||
@@ -8,0 +8,0 @@ "repository": { |
6967
162