Unable to initialize socket connection


#1

Hi,
I’m unable to initialize the socket connecion. Here is the error I’m getting. Please help me in this issue.

C:\EMS\microserver>wsems
[INFO ] 2018-05-08 12:45:45,20 wsems: Using config file: C:\EMS\microserver\etc\config.json
[FORCE] 2018-05-08 12:45:45,20 wsems: Starting up …
[FORCE] 2018-05-08 12:45:45,28 wsems: Initializing EMS …

academic-thingworxconnectivity.portal.ptc.io:443–>[FORCE] 2018-05-08 12:45:45,28 main: Using config file C:\EMS\microserver\etc\config.json
[INFO ] 2018-05-08 12:45:45,28 wsems: Creating the WsEms proxy.
[INFO ] 2018-05-08 12:45:45,28 wsems: Starting HTTP Server.
[INFO ] 2018-05-08 12:45:45,28 wsems: Initializing the ThingWorx REST interface.
[FORCE] 2018-05-08 12:45:45,29 httpServer: starting http server port=8000
[INFO ] 2018-05-08 12:45:45,41 wsEmsProxy::initialize: Initialization complete!
[INFO ] 2018-05-08 12:45:45,41 wsems: Starting the connection.
[ERROR] 2018-05-08 12:45:46,61 SDK: Error intializing socket connection. Err = -1
[ERROR] 2018-05-08 12:45:46,61 SDK: twWs_Connect: Error restarting socket. Error 0
[ERROR] 2018-05-08 12:45:52,69 SDK: Error intializing socket connection. Err = -1
[ERROR] 2018-05-08 12:45:52,69 SDK: twWs_Connect: Error restarting socket. Error 0


#2

Hello,

It is hard to tell the issue from that error. Please provide more details about your setup.Ex:

  1. Did you download the TLS certificate from the Thingworx server and placed it in you EMS folder?
  2. Did you generate an application key from the TW Composer?
  3. Did you configure the config.json file properly?

{“ws_servers”:[{
“host”:“academic-thingworxcapstone.portal.ptc.io”,
“port”:443
}],
"appKey”:”**********************”,
“certificates”: {
“validate”:false,
“cert_chain”:[“tw.crt”]
},
“auto_bind”: [{
“name”: “thing_name”
}]
}


#3

Hi,
Here are the Screenshots of config.json file certificate.


#4

Your setup seems ok. The EMS can show a lot of errors, but still work. To test if the EMS is really connected, create a remote thing (with remote thing template) and add it to the config.json file like this:
“auto_bind”: [{
“name”: “your_thing_name”
}]

Then go to your thing property section and check if the isConnected property is true. You might need to click the refresh button to update.