如何通过TCP从离子(phonegap)连接到服务器上的websocket?

I have installed and running this script on server: https://github.com/gorilla/websocket Everything was configured and running ok when I was using ios native application but now I have to switch to phonegap and I cannot find example which is working. I cannot move to another script on my server because it would be to much work. Is there any way that I can connect to my server from phonegap ionic? My application is for ios and android, it's game which needs real time connection just like chat application. Thank you