Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hi, all
I have succeeded in connecting to TW platform from EMS, sending/receiving data, executing services etc..
However, once the devices are disconnected from the network,
EMS continues to fail to re-establish the connection to TW despite a network restoration.
Following are log and config.json.
Are there any setting items yet to be set?
Regards,
S.Yamabe
log
{"level":"FORCE","timestamp":"2016-02-16T15:06:10,393","origin":"C:\EMSProject_Basic\wsems.exe","content":"Starting up ...."}
{"level":"FORCE","timestamp":"2016-02-16T15:06:10,451","origin":"C:\EMSProject_Basic\wsems.exe","content":"Initializing EMS ...."}
{"level":"FORCE","timestamp":"2016-02-16T15:06:10,476","origin":"main","content":"Using config file C:\\EMSProject_Basic\\etc\\config.json"}
{"level":"FORCE","timestamp":"2016-02-16T15:06:10,501","origin":"httpServer","content":"starting http server port=8000"}
{"level":"AUDIT","timestamp":"2016-02-16T15:06:10,534","origin":"SDK","content":"twWs_Connect: Websocket connected!"}
== DISCONNECTED FROM NETWORK ==
{"level":"WARN","timestamp":"2016-02-16T15:07:15,814","origin":"SDK","content":"apiThread: Did not receive pong in time"}
{"level":"WARN","timestamp":"2016-02-16T15:07:15,877","origin":"SDK","content":"msgHandlerOnClose: WEBSOCKET CLOSED"}
{"level":"ERROR","timestamp":"2016-02-16T15:07:15,901","origin":"SDK","content":"Error intializing socket connection. Err = -1"}
{"level":"ERROR","timestamp":"2016-02-16T15:07:15,926","origin":"SDK","content":"twWs_Connect: Error restarting socket. Error 0"}
{"level":"ERROR","timestamp":"2016-02-16T15:07:20,828","origin":"SDK","content":"Error intializing socket connection. Err = -1"}
{"level":"ERROR","timestamp":"2016-02-16T15:07:20,877","origin":"SDK","content":"twWs_Connect: Error restarting socket. Error 0"}
{"level":"ERROR","timestamp":"2016-02-16T15:07:25,828","origin":"SDK","content":"Error intializing socket connection. Err = -1"}
{"level":"ERROR","timestamp":"2016-02-16T15:07:25,987","origin":"SDK","content":"twWs_Connect: Error restarting socket. Error 0"}
== RECONNECTED TO NETWORK ==
{"level":"ERROR","timestamp":"2016-02-16T15:07:30,829","origin":"SDK","content":"Error intializing socket connection. Err = -1"}
{"level":"ERROR","timestamp":"2016-02-16T15:07:30,894","origin":"SDK","content":"twWs_Connect: Error restarting socket. Error 0"}
{"level":"ERROR","timestamp":"2016-02-16T15:07:56,835","origin":"SDK","content":"Error intializing socket connection. Err = -1"}
{"level":"ERROR","timestamp":"2016-02-16T15:07:56,887","origin":"SDK","content":"twWs_Connect: Error restarting socket. Error 0"}
... continuing same logs ...
config.json
{
"ws_servers": [{
"host": "<hostname>",
"port": 443
}],
"appKey": "<appkey>",
"certificates": {
"validate": false
},
"ws_connection": {
"encryption": "ssl",
"verbose": false
},
"proxy": {
"host": "<proxy>",
"port": <port>,
"user": "<user>",
"password": "<pass>"
},
"logger": {
"level": "WARN",
"publish_directory": "C:/EMS/logs/",
"publish_level": "WARN",
"max_file_storage": 2000000,
"auto_flush": true
},
"offline_msg_store": {
"enabled": true,
"directory": "C:/EMS/Offline",
"max_size": 65535
},
"file": {
"buffer_size": 8192,
"max_file_size": 8000000000,
"virtual_dirs": [{
"tw": "c:\\EMS"
}],
"staging_dir": "C:\\EMS\\Staging"
}
}
Yamabe, what version of the wsems is this? Also, what proxy is involved? Just to make sure, under your certificate section can you add: "allow_self_signed": true and also set verbose: true under ws_connection and post the complete set of logs?
Aanjan Ravi,
Thank you for your reply.
Version of WSEMS
I don't know what version of wsems I use, but I re-downloaded it from Device QuickStart Kits | ThingWorx and tried today.
Maybe latest version?
Proxy
In my company, we must connect from intranet to the internet via proxy with authentication.
For this case, EMS is in intra and TW is on the internet, so I have to have proxy setting.
I don't know of (and I couldn't tell) detail because it is managed by Infrastructure department,
but the proxy seems to be built by squid.
Log
I added two settings you specified, and changed log levels to "TRACE"
(because the WARN log output had been exactly the same despite adding two option)
I attach the full log to this post.
Additional information.
So it seems to be a problem of proxy..
Does this occur for any of the proxies or on specific conditions?
Regards,
S.Yamabe
If it is using a reverse proxy, you don't need to add the proxy header section (as anything connecting shouldn't even know there's a proxy involved). Can you check if the proxy server you are using supports websockets?
Aanjan Ravi worte
Can you check if the proxy server you are using supports websockets?
I will. However, it will take quite a few time and I'm not sure if I can know the detail..
Two things I'm sure of are...
Regarding your second point, when you have an active connection, can you do file transfers (I'm asking because you've added them in the config.json) or even add the sample/example properties through the luaScriptResource into the platform and check if they function correctly?
Aanjan Ravi wrote:
Regarding your second point, when you have an active connection, can you do file transfers (I'm asking because you've added them in the config.json) or even add the sample/example properties through the luaScriptResource into the platform and check if they function correctly?
As far as we have a valid connection, we can send files from the repository on the Platform to EMS, and vice versa.
Adding and binding remote properties from LSR through EMS also works and properties are being updated for every scanRate time...
Going off on the subject a bit, we cannot connect to the Platform through proxy by Java SDK at all (with proxy setting items set, of course).
Probably I will post another topic for this problem, but I just wrote it here because it could be any hint.