I tested my code again today (I was preparing something to post for you on 
github) and surprise!: The CN1 app was able to communicate with my 
socket.io server and I the javascript logs where correctly output in my 
device adb logcat (meaning BrowserComponent.execute() javascript calls 
where correctly executed ). I really don't know why it did not work 
yesterday and does today as I didn't change anything in my code (either in 
the CN1 app or the server). That is a complete mystery.
Anyway, I am now facing another issue.  My CN1 app is now able to send the 
socket.io handshake request to my server (that correctly receved it, as I 
can see in it's log) but the handshake is unable to succeed due to a CORS 
issue (only on the device, still works on the simulator. And I must say 
that the simulator and the server are run on 2 different PCs (and have 2 
different IPs) so the situation is strictly the same in what concerns CORS 
when run on the simulator or on my real android device). 
In the adb logcat, I can see this error message:
 [main] 0:0:2,36 - [ERROR] Failed to load 
http://192.168.8.100:3030/socket.io/?EIO=3&transport=polling&t=MAJ14W8: 
Response to preflight request doesn't pass access control check: The 
'Access-Control-Allow-Origin' header has a value 'null' that is not equal 
to the supplied origin. Origin 'null' is therefore not allowed access. On 
line 0 of file:///android_asset/socket_io.html
(192.168.8.100:3030 being my server url  and socket_io.html my embeded CN1 
asset that loads the socket.io.js embeded asset script)  

This is kind of strange as if I call http:
//192.168.8.100:3030/socket.io/?EIO=3&transport=polling&t=MAJ14W8 inside my 
chrome browser,  in the response header I can see Access-Control-Allow-
Origin: * so I don't get it why the BrowserComponent has a 'null' value for 
it...
Do you already experienced using a javascript lib with CORS permissions 
inside the BrowserComponent on android? 

I can post something on github for you to test if you want to (and have the 
time to look at it) but as my socket.io server is not public yet, you would 
also have to run a small socket.io server (or to find a public one) to be 
able to see the issue (I can post the code of a small soket.io server to 
use with the test CN1 app but it would requiere you to install node.js)

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/55d571c9-f7b7-41ce-b64f-ec120c0aecd9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to