omorandi / tiws

a very simple Titanium module (iOS / Android) for creating native websockets
131 stars 63 forks source link

Error trying to connect http server with socket.io #25

Open ottopic opened 8 years ago

ottopic commented 8 years ago

I'm trying to use that library but it get error when I try to connect with socket.io

[INFO] : error!"{\"code\":0,\"message\":\"Transport unknown\"}" [INFO] : error!"HTTP error"

var io = require('socket.io'),
socket = io.connect(uri);

socket.on('connect', function (e) {
    Ti.API.log('connected!');
});

socket.on('error', function (e) {
    Ti.API.log('error!' + JSON.stringify(e));
});

How can help me?

xChat commented 8 years ago

io('https://server.ip:1234', { transports: ['websocket'] });

Need to use websocket transport only.

Thanks. On 30 Mar 2016 6:37 am, "Lorenzo" notifications@github.com wrote:

I'm trying to use that library but it get error when I try to connect with socket.io

[INFO] : error!"{\"code\":0,\"message\":\"Transport unknown\"}" [INFO] : error!"HTTP error"

var io = require('socket.io'), socket = io.connect(uri);

socket.on('connect', function (e) { Ti.API.log('connected!'); });

socket.on('error', function (e) { Ti.API.log('error!' + JSON.stringify(e)); });

How can help me?

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/omorandi/tiws/issues/25

ottopic commented 8 years ago

https is required?

I tried with your reformatted socket.io. Can't find variable: OS_IOS. Where I can set the variable?

xChat commented 8 years ago

You need to use the Alloy project template, otherwise just define your own OS_IOS which just a boolen true if running on iOS, thanks.

Do the same for OS_ANDROID too.

On Wed, 30 Mar 2016 9:00 am Lorenzo notifications@github.com wrote:

https is required?

I tried with your reformatted socket.io. Can't find variable: OS_IOS. Where I can set the variable?

— You are receiving this because you commented.

Reply to this email directly or view it on GitHub https://github.com/omorandi/tiws/issues/25#issuecomment-203130436

MahmoudElmoghazy commented 7 years ago

@xChat This option doesn't work the issue cause the versions did u find any solutions ?