Ionic udp and ChromeSocketsUdp

Hello,

Im trying to develop ionic application with udp broadcast. Currently im struggling with cordova-plugin-chrome-apps-sockets-udp. I manage to add it into my project, chrome and udp is working (it is NOT ‘undefined’)
but i cant create socket. When i was trying to look what is going inside i see that :

exports.create = function(properties, callback) {
    if (typeof properties == 'function') {
        callback = properties;
        properties = {};
    }
    var win = callback && function(socketId) {
        var createInfo = {
            socketId: socketId
        };
        callback(createInfo);
    };
    checkBufferSize(properties.bufferSize);
    exec(win, null, 'ChromeSocketsUdp', 'create', [properties]);
};

and everything is ok - its going to exec(win, null, ‘ChromeSocketsUdp’, ‘create’, [properties]); but next in



function exec(success, fail, service, action, args) {
    // If we have a local handler, call that. Otherwise pass it to the simulation host.
    var handler = pluginHandlers[service] && pluginHandlers[service][action];
    if (handler) {
        telemetry.sendClientTelemetry('exec', { handled: 'app-host', service: service, action: action });

        // Ensure local handlers are executed asynchronously.
        setTimeout(function () {
            handler(success, fail, args);
        }, 0);
    } else {
        var execIndex = nextExecCacheIndex++;
        execCache[execIndex] = { index: execIndex, success: success, fail: fail };
        socket.emit('exec', { index: execIndex, service: service, action: action, args: args, hasSuccess: !!success, hasFail: !!fail });
    }
}

it not creating pluginhandler - when trying to pluginHandlers[service] it says Undefined . How to fix it ??

My code below:

chrome.sockets.udp.create({}, function (socketInfo) {
   // <<<NEVER GET HERE>
     // The socket is created...
     console.log("The socket is created...");
     var socketId = socketInfo.socketId;
     // Setup a listener event handler 
     chrome.sockets.udp.onReceive.addListener(self.onReceive);
     // Bind the socket
     chrome.sockets.udp.bind(socketId, "0.0.0.0", 0, function (result) {
       if (result < 0) {
         console.log("Error binding socket.");
         return;
       }
       // send out a message
       chrome.sockets.udp.send(socketId, arrayBuffer,
         '255.255.255.255', 9999, function (sendInfo) {
           console.log("sent " + sendInfo.bytesSent);
         });
       // reminder: 255.255.255.255:9999 is the message destination address
     });

   });

Not sure if it helps but dont use function, but only fat arrow to define callbacks