Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RoboVM java.lang.IllegalArgumentException: unexpected url. #215

Closed
ollyde opened this issue Sep 13, 2015 · 15 comments
Closed

RoboVM java.lang.IllegalArgumentException: unexpected url. #215

ollyde opened this issue Sep 13, 2015 · 15 comments

Comments

@ollyde
Copy link

ollyde commented Sep 13, 2015

I'm using this excellent implementation of sockets for my cross-platform projects, keep up the good work!

BUT! I know there's no real support for it and it's probably not in you're scope but my problem is I'm using RoboVM to compile my Java code into machine code for iOS, everything works perfect except something is broken on the connection with this library.

I'm using this implementation

//192.168.1.11:9999 OR https://192.168.1.11:9999
URI uri = new URI(ServerController.WEB_SERVER_API);  
socketIOClient = IO.socket(uri);
socketIOClient.on(Socket.EVENT_CONNECT, new Emitter.Listener()

I get the following error:

OLLY:LOG: Connecting with server: http://192.168.1.11:9999
java.lang.IllegalArgumentException: unexpected url: http://192.168.1.11:9999/socket.io/?EIO=3&sid=3x4xcfIDbrYeX7RlAAAH&transport=websocket
        at com.squareup.okhttp.Request$Builder.url(Request.java:153)
        at io.socket.engineio.client.transports.WebSocket.doOpen(WebSocket.java:53)
        at io.socket.engineio.client.Transport$1.run(Transport.java:76)
        at io.socket.thread.EventThread.exec(EventThread.java:50)
        at io.socket.engineio.client.Transport.open(Transport.java:71)
        at io.socket.engineio.client.Socket.probe(Socket.java:459)
        at io.socket.engineio.client.Socket.onOpen(Socket.java:472)
        at io.socket.engineio.client.Socket.onHandshake(Socket.java:512)
        at io.socket.engineio.client.Socket.onPacket(Socket.java:486)
        at io.socket.engineio.client.Socket.access$900(Socket.java:30)
        at io.socket.engineio.client.Socket$5.call(Socket.java:300)
        at io.socket.emitter.Emitter.emit(Emitter.java:117)
        at io.socket.engineio.client.Transport.onPacket(Transport.java:124)
        at io.socket.engineio.client.transports.Polling.access$700(Polling.java:16)
        at io.socket.engineio.client.transports.Polling$2.call(Polling.java:123)
        at io.socket.engineio.parser.Parser.decodePayload(Parser.java:255)
        at io.socket.engineio.client.transports.Polling._onData(Polling.java:133)
        at io.socket.engineio.client.transports.Polling.onData(Polling.java:105)
        at io.socket.engineio.client.transports.PollingXHR$5$1.run(PollingXHR.java:113)
        at io.socket.thread.EventThread$2.run(EventThread.java:75)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at java.lang.Thread.run(Thread.java:837)

If anyone would have any ideas? tried compiling with:

compile 'io.socket:socket.io-client:0.6.1'
@ollyde
Copy link
Author

ollyde commented Sep 13, 2015

It would seem the error is here:

//at io.socket.engineio.client.transports.WebSocket.doOpen(WebSocket.java:53)
Request.Builder builder = new Request.Builder().url(uri());

This creates a null URI only on RoboVM.

//at com.squareup.okhttp.Request$Builder.url(Request.java:147)
if (url == null) throw new IllegalArgumentException("url == null");

I'd like to download the library and modify it but that's broken too.

@NoahAndrews
Copy link

Fellow RovoVM user here! Why not just use a String, at least for now?

@ollyde
Copy link
Author

ollyde commented Sep 13, 2015

I did try lots of variations of strings with no success, exactly the same error.

I even tried manually building a URI

URI uri = new URI("http", "", "192.168.1.11", 9999, "/", "", null);

Still gives the same error :-(

@NoahAndrews
Copy link

Have you tried stepping through the part where it crashes using the debugger? (if you have the paid version)

@ollyde
Copy link
Author

ollyde commented Sep 13, 2015

I got a feeling it will lead me too the same stack trace though, it seems no matter what I put when creating a new socket in this library it crashes for iOS.

I'd like to download the library and modify it but I spent all morning just trying to get it working with no success.

Any ideas?

@NoahAndrews
Copy link

Just put a breakpoint just before the problem, and click the debug button. It integrates with the IDE's debugger, at least on IntelliJ.

@ollyde
Copy link
Author

ollyde commented Sep 15, 2015

I've submitted a cross platform app example that works on Desktop, Android but not IOS here:
https://github.com/voidstarfire/LibGDX-SocketIO-with-Node/tree/master

@nuclearace
Copy link
Member

Wouldn't this be more of an issue of RoboVM not properly generating the iOS?

@ollyde ollyde closed this as completed Sep 15, 2015
@nuclearace
Copy link
Member

Also, on what arch are you running the iOS one on? It could be a problem with that specific architecture.

@ollyde
Copy link
Author

ollyde commented Sep 15, 2015

archs = 'arm64:thumbv7'

@ollyde
Copy link
Author

ollyde commented Sep 15, 2015

Flagged an issue here.
robovm/robovm#1153

@ollyde ollyde reopened this Sep 22, 2015
@ollyde
Copy link
Author

ollyde commented Sep 22, 2015

It seems to be an issue with the web sockets class in this library but I can't figure it out.
I've made a test application here:
https://github.com/voidstarfire/LibGDX-SocketIO-with-Node/tree/master

@NoahAndrews
Copy link

See Stefan's response to this thread and see if that fixes your problem https://groups.google.com/forum/#!topic/robovm/m3XC_LdBVpU

@ollyde ollyde closed this as completed Oct 21, 2015
@ollyde
Copy link
Author

ollyde commented Oct 21, 2015

Fixed in RoboVM 1.9

@nkzawa
Copy link
Contributor

nkzawa commented Oct 21, 2015

@voidstarfire 👍 great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants