@Marcelwinter04 wrote:
Hi Guys,
i have a problem with the chrome.sockets.tcp plugin.
I´m always getting the error “Uncaught InvalidCharacterError: ‘atob’ failed: The string to be decoded is not correctly encoded. cordova.js:311
cordova.callbackFromNative cordova.js:311
(anonymous function)” when receiving data from the server.Here is my code;
connect() { console.log("pressed"); (<any>window).chrome.sockets.tcp.create({}, createInfo => { this.socketTcpId = createInfo.socketId; console.log(createInfo); (<any>window).chrome.sockets.tcp.setPaused(this.socketTcpId, false ); (<any>window).chrome.sockets.tcp.onReceive.addListener( info => { //callback function with info as the parameter console.log(info); console.log("test"); }); (<any>window).chrome.sockets.tcp.onReceiveError.addListener( info => { console.log(info); console.log("mooo"); }); (<any>window).chrome.sockets.tcp.connect(this.socketTcpId, "192.168.2.202", 5555, result => { console.log("Connected to server"); },error => { console.log(error); }); }); }The send method works perfectly.
send(){ var data2send= this.str2arrayBuffer( "Message Message Message\n\r"); // connection ok, send the packet (<any>window).chrome.sockets.tcp.send(this.socketTcpId, data2send); }Has anyone an idea what i´m doing wrong?
Posts: 1
Participants: 1