How to use the coap.globalAgentIPv6 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 PeterEB / coap-shepherd / lib / init.js View on Github external
});

    server.listen(shepherd._net.port, function (err) {
        if (err)
            deferred.reject(err);
        else
            deferred.resolve(server);
    });

    if (shepherd._config.connectionType === 'udp6') {
        coap.globalAgentIPv6 = new coap.Agent({
            type: shepherd._config.connectionType,
            socket: server._sock
        });

        shepherd._agent = coap.globalAgentIPv6;
    } else {
        coap.globalAgent = new coap.Agent({
            type: shepherd._config.connectionType,
            socket: server._sock
        });
        
        shepherd._agent = coap.globalAgent;
    }
    
    
    return deferred.promise.nodeify(callback);
};