How to use the coap/common.Type.Con function in coap

To help you get started, we’ve selected a few coap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kinoma / kinomajs / xs6 / sources / mc / extensions / coap / client.js View on Github external
(response, peer) => {
				let request = this.findRequest(response);
				let endpoint = this.endpoints[peer];

				if (!request || !endpoint) {
					this.transport.sendReset(response, peer);
					return;
				}

				if (response.type == Type.Con) {
					this.transport.sendAck(response, peer);
				}

				if (response.type === Type.Ack) {
					if (!request['ack']) {
						request['ack'] = Date.now();

						if (request.onAck) {
							request.onAck();
						} else if (this.onAck) {
							this.onAck(request);
						}

						endpoint.dequeue(request);
					}
				}