Cannot get blocshop TCP sockets-for-cordova to work

Need to have an Ionic mobile app connect to a Java Tomcat application server using TCP sockets. Have done the following:

  1. Per the blocshop site ( directions installed the plugin with: cordova plugin add cz.blocshop.socketsforcordova

  2. Added script src=“socket.js” below script src=“cordova.js” in the index.html file.

  3. When run in a debug mode in WebStorm the construct var socket = new Socket(); results in the error: ReferenceError: Socket is not defined

Any assistance on how to get blocshop TCP sockets-for-cordova to work in an Ionic project is welcomed.

Did initialize socket (var socket = new Socket()) after deviceready event is called?

I am having the same problem TCP sockets-for-cordova in webstorm, calling it after device ready doesn’t work for me. Did you get it to work. Please assist.

For me it’s work but it’s really slow… install cordova plugin like:
cordova plugin add cz.blocshop.socketsforcordova
or cordova plugin add
and in your method you can make

let IP = "";
let Port = 1234
let socket = new (<any>window).Socket();, Port,
            function() {
                console.log('socket open');
                var dataString = "Printer is workly ! Printer is workly ! Printer is workly ! Printer is workly !";
                var data = new Uint8Array(dataString.length);
                for (var i = 0; i < data.length; i++) {
                  data[i] = dataString.charCodeAt(i);
                console.log('before write');
                console.log('after write');


            function(errorMessage) {
            // invoked after unsuccessful opening of socket
1 Like