udp-messenger
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "udp-messenger", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Send messages over udp in small chunks", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -76,2 +76,6 @@ 'use strict' | ||
let onreceived = (message)=> { | ||
setTimeout(()=>{ | ||
let messageBox = _messageBox.get(this) | ||
messageBox.delete(message.msgId.toString('hex')) | ||
}, timeout + 1000) | ||
this.emit('message', message.message) | ||
@@ -94,2 +98,3 @@ } | ||
let id = part.msgId.toString('hex') | ||
let message = messageBox.get(id) | ||
@@ -121,3 +126,2 @@ if (!message) { | ||
} | ||
message.receive(part) | ||
@@ -146,3 +150,3 @@ messageBox.set(id, message) | ||
messageBox.delete(id) | ||
messageBox.set(this, messageBox) | ||
_messageBox.set(this, messageBox) | ||
} | ||
@@ -186,2 +190,5 @@ }, timeout + 1000) | ||
} | ||
if (host === '127.0.0.1' && port === _port.get(this) ){ | ||
throw new TypeError("Invalid host") | ||
} | ||
let messageBox = _messageBox.get(this) | ||
@@ -188,0 +195,0 @@ let onsent = _onsent.get(this) |
14088
420