I haven't used socket.io before.  But here is the strategy I would use for
testing:

1. First try to get it working with a visible browser component.  Having it
invisible may present some extra obstacles.
2. Make sure you are using the polling option of socket.io because the
BrowserComponent in the simulator doesn't support Websockets.  (This is not
to be confused with the websockets cn1lib - as CN1 does support websockets,
just not inside the BrowserComponent).
3. Create as small a test case as possible to demonstrate your issue, and
share the bits of code where you're getting stuck - and I can try to help.

If you're using the BrowserComponent just for a socket.io client, I would
suggest instead to try to port the Android socket.io client to Codename One
https://github.com/socketio/socket.io-client-java

Most of this would should be pretty straight forward.  You'd just need to
change the WebSocket code to use cn1-websockets instead of the Android
websocket API.

Steve

On Tue, Mar 20, 2018 at 2:54 PM, thomas <[email protected]> wrote:

> I am trying to use the socket.io javascript lib in a BrowserComponent
> (that is not displayed).
> When I send a message (=emit) to the server, everything is working fine.
> The server correctly receve the emited packet. However, when the server try
> to answer, it fails with a "connection timeout" error (and the packet is
> never received by the codename one app, that I run in the simulator). The
> connection between the cn1 app and the server is still active though as, if
> I kill the simulator (that runs the cn1 app), the server is correctly able
> to detect that the connection has just been closed.
> Any idea of what may be the reason of this "connection timeout" error (the
> server is not at cause here as it works just well with a react-native app
> that I am trying to port to cn1)? Anyone already succeed using socket.io
> with the BrowserComponent?
>
> --
> 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/11974af7-04a8-4432-8aff-
> fe7043e2e654%40googlegroups.com
> <https://groups.google.com/d/msgid/codenameone-discussions/11974af7-04a8-4432-8aff-fe7043e2e654%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Steve Hannah
Software Developer
Codename One
http://www.codenameone.com

-- 
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/CAGOYrKUH_wsCDyLBmbb%2BDj17d4bJaDum%2BKWaoOUMSnfs8Lbceg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to