Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hello,
I am new to Thingworx and trying to build a mobile App connecting to a Thingworx Server using the Android SDK. However I can't get it work.
Following the tutorials my code looks like this:
ClientConfigurator config = new ClientConfigurator();
String uri = "wss://"+ip+":"+port+"/Thingworx/WS";
config.setUri(uri);
config.setAppKey(appKey);
client = new AndroidConnectedThingClient(config);
client.start();
This should be enough to start the connection, right?
Android monitor shows logs this when trying to execute:
11-06 18:05:59.920 30662-30662/home.ba I/ClientMessageProcessor: Created new ClientMessageProcessor [minPoolSize: 4, maxPoolSize: 10, maxThreadLife: 10000, maxQueueSize: 1000]
11-06 18:05:59.929 30662-31544/home.ba I/ConnectivityMonitorTask: Endpoint not connected [name: EP_0, id: 0]. Attempting [re]connect...
11-06 18:05:59.929 30662-31544/home.ba I/*tCommunicationEndpoint: Needed to refill connections on client endpoint [id: 0] : [active: 0, max: 1]
11-06 18:05:59.931 30662-31545/home.ba D/com.thingworx.communications.client.connection.autobahn.AutobahnConnectionThread: Connection construction thread created: 30175
11-06 18:05:59.940 30662-31545/home.ba D/de.tavendo.autobahn.WebSocketConnection: WebSocket connection created.
11-06 18:05:59.941 30662-31545/home.ba I/*tobahnClientConnection: Created new AutobahnClientConnection: AutobahnClientConnection [id: 0-0]
11-06 18:05:59.948 30662-31546/home.ba D/NetworkSecurityConfig: No Network Security Config specified, using platform default
11-06 18:05:59.951 30662-31545/home.ba I/*tobahnClientConnection: [websocket id: 0-0] Closing underlying websocket channel
11-06 18:05:59.952 30662-31545/home.ba D/de.tavendo.autobahn.WebSocketConnection: Could not send WebSocket Close .. writer already null
11-06 18:05:59.952 30662-31545/home.ba E/*tobahnClientConnection: [websocket id: 0-0] Could not unregister AutobahnClientConnection from ClientEndpoint because endpoint is NULL!
11-06 18:05:59.952 30662-31545/home.ba I/*tobahnClientConnection: Websocket has been closed.
11-06 18:05:59.959 30662-31544/home.ba I/*tCommunicationEndpoint: Preparing new Connection Authentication Request: DispatchingClientEndpoint [id: 0, isConnected: false, open connections: 0, max connections: 1]
11-06 18:05:59.965 30662-31544/home.ba E/*tobahnClientConnection: Failed to deliver binary message.
11-06 18:06:59.967 30662-31544/home.ba E/*tCommunicationEndpoint: Refilling connections on [endpoint 0, uri: wss://134.147.106.212:443/Thingworx/WS] failed : Timed out AuthRequestMessage [requestId: 1, endpointId: -1, sessionId: -1, method: AUTHREQUEST]
11-06 18:06:59.968 30662-31544/home.ba E/*tCommunicationEndpoint: Exception refilling connections was:
java.util.concurrent.TimeoutException: Timed out AuthRequestMessage [requestId: 1, endpointId: -1, sessionId: -1, method: AUTHREQUEST]
at com.thingworx.communications.common.endpoints.CommunicationEndpoint.sendConnectionAuthRequest(CommunicationEndpoint.java:525)
at com.thingworx.communications.client.endpoints.ClientCommunicationEndpoint.authenticateConnection(ClientCommunicationEndpoint.java:125)
at com.thingworx.communications.client.endpoints.ClientCommunicationEndpoint.refillConnections(ClientCommunicationEndpoint.java:214)
at com.thingworx.communications.common.endpoints.monitor.ConnectivityMonitorTask.dutyCycleOn(ConnectivityMonitorTask.java:135)
at com.thingworx.communications.common.endpoints.monitor.ConnectivityMonitorTask.run(ConnectivityMonitorTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
11-06 18:06:59.968 30662-31544/home.ba I/ConnectivityMonitorTask: Endpoint reconnection was unsuccessful [name: EP_0, id: 0]
11-06 18:07:00.969 30662-31544/home.ba I/ConnectivityMonitorTask: Endpoint not connected [name: EP_0, id: 0]. Attempting [re]connect...
11-06 18:07:01.030 30662-31544/home.ba I/*tCommunicationEndpoint: Needed to refill connections on client endpoint [id: 0] : [active: 0, max: 1]
11-06 18:07:01.031 30662-32462/home.ba D/com.thingworx.communications.client.connection.autobahn.AutobahnConnectionThread: Connection construction thread created: 30177
11-06 18:07:01.031 30662-32462/home.ba D/de.tavendo.autobahn.WebSocketConnection: WebSocket connection created.
11-06 18:07:01.032 30662-32462/home.ba I/*tobahnClientConnection: Created new AutobahnClientConnection: AutobahnClientConnection [id: 0-0]
11-06 18:07:01.035 30662-32462/home.ba I/*tobahnClientConnection: [websocket id: 0-0] Closing underlying websocket channel
11-06 18:07:01.036 30662-32462/home.ba D/de.tavendo.autobahn.WebSocketConnection: Could not send WebSocket Close .. writer already null
11-06 18:07:01.036 30662-32462/home.ba E/*tobahnClientConnection: [websocket id: 0-0] Could not unregister AutobahnClientConnection from ClientEndpoint because endpoint is NULL!
11-06 18:07:01.036 30662-32462/home.ba I/*tobahnClientConnection: Websocket has been closed.
11-06 18:07:01.036 30662-31544/home.ba I/*tCommunicationEndpoint: Preparing new Connection Authentication Request: DispatchingClientEndpoint [id: 0, isConnected: false, open connections: 0, max connections: 1]
11-06 18:07:01.038 30662-31544/home.ba E/*tobahnClientConnection: Failed to deliver binary message.
Can anybody tell me what I'm doing wrong?
David Kirstein: It seems there is some issue in communicating over web socket connection. Please confirm and verify the port you have used as it seems you SSL enabled web socket connection.
-Durgesh
Durgesh Patel Thank you for your answer! I'm using the standart SSL port 443.