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
I am using raspberry pi , after launching exmaple three agent in node.js ( in order to connect to thingworx composer) I get intializing web socket error ( response code:400). what should I do?
Are you sure you have configured the EMS properly? Have you check out the Edge Help Center?
I am new to iot and Raspberry pi, I have used step by step thingworx raspberry pi quick start for setting up thingworx composer connection to pi; I am using the ip address provided beneath the thingworx platform server launch button, at thingworx dashboard on web. I think everything is ok but the connection couldn't get stablished.
Can you post the contents of your config.json file from the EMS? Did you create an application key on the Platform?
Are you using the node.js sdk?
yes, as I told
Please post a log file or your console output or some kind of error message so we can help you further.
thanks for your in time answer and sorry for my late one! I was away some days.
at the moment I am using EMS on pi, after configuring the config.jason file according to my thingworx foundation server ip address and son on...I am getting this error when trying to connect to the thingworx server:
pi@raspberrypi:~/Downloads/microserver $ sudo ./wsems
[INFO ] 2016-11-12 12:35:24,487 ./wsems: Using config file: /home/pi/Downloads/microserver/etc/config.json
[FORCE] 2016-11-12 12:35:24,488 ./wsems: Starting up ....
[FORCE] 2016-11-12 12:35:24,488 ./wsems: Initializing EMS ....
[FORCE] 2016-11-12 12:35:24,489 main: Using config file /home/pi/Downloads/microserver/etc/config.json
[INFO ] 2016-11-12 12:35:24,489 ./wsems: Creating the WsEms proxy.
[INFO ] 2016-11-12 12:35:24,489 ./wsems: Starting HTTP Server.
[INFO ] 2016-11-12 12:35:24,490 ./wsems: Initializing the ThingWorx REST interface.
[FORCE] 2016-11-12 12:35:24,490 httpServer: starting http server port=8080
[DEBUG] 2016-11-12 12:35:24,491 httpServer: http server bound to port=8080.
[DEBUG] 2016-11-12 12:35:24,491 SDK: twWs_Create: Initializing Websocket Client for 52.21.84.86:80//Thingworx/WS
[DEBUG] 2016-11-12 12:35:24,491 SDK: twTlsClient_Create: Initializing TLS Client
[DEBUG] 2016-11-12 12:35:24,492 SDK: twApi_Initialize: Websocket Established after 0 tries
[INFO ] 2016-11-12 12:35:24,492 SDK: twApi_SetOfflineMsgStoreDir: Created offline message file /opt/thingworx/offline_msgs.bin
[INFO ] 2016-11-12 12:35:24,492 SDK: twApi_SetOfflineMsgStoreDir: Created subscribed file /opt/thingworx/subscribed_props.bin
[DEBUG] 2016-11-12 12:35:24,493 SDK: subscribedPropsMgr_Initialize: Initializing subscribed properties manager
52.21.84.86:80-->[DEBUG] 2016-11-12 12:35:24,493 jsonConfigurator::getJsonEntity: Key cert_chain not found
[DEBUG] 2016-11-12 12:35:24,494 jsonConfigurator::getJsonEntity: Key validation_criteria not found
[DEBUG] 2016-11-12 12:35:24,494 jsonConfigurator::getJsonEntity: Parent file not found
[WARN ] 2016-11-12 12:35:24,494 SDK: Creating Staging Directory at path = /opt/thingworx/tw_staging
[DEBUG] 2016-11-12 12:35:24,495 jsonConfigurator::getJsonEntity: Parent file not found
[INFO ] 2016-11-12 12:35:24,495 wsEmsProxy::initialize: Initialization complete!
[INFO ] 2016-11-12 12:35:24,495 ./wsems: Starting the connection.
[DEBUG] 2016-11-12 12:35:24,496 SDK: twTlsClient_Reconnect: Re-establishing SSL context
[DEBUG] 2016-11-12 12:35:24,496 SDK: twTlsClient_Connect: Connecting to server
[ERROR] 2016-11-12 12:35:25,508 SDK: twWs_Connect: Error initializing web socket. Response code: 400
[DEBUG] 2016-11-12 12:35:30,508 SDK: twTlsClient_Reconnect: Re-establishing SSL context
[DEBUG] 2016-11-12 12:35:30,509 SDK: twTlsClient_Connect: Connecting to server
[ERROR] 2016-11-12 12:35:31,139 SDK: twWs_Connect: Error initializing web socket. Response code: 400
the same error I was getting with node.js
by the way, I have also downloaded the thingworx downloadable developer edition on my pc, trying to get connected from pi to my pcś local host, this time there is no web socket error but the error below pops up:
sudo ./wsems
[INFO ] 2016-11-12 13:41:10,651 ./wsems: Using config file: /home/pi/Downloads/microserver/etc/config.json
[FORCE] 2016-11-12 13:41:10,651 ./wsems: Starting up ....
[FORCE] 2016-11-12 13:41:10,651 ./wsems: Initializing EMS ....
[FORCE] 2016-11-12 13:41:10,651 main: Using config file /home/pi/Downloads/microserver/etc/config.json
[INFO ] 2016-11-12 13:41:10,652 ./wsems: Creating the WsEms proxy.
[INFO ] 2016-11-12 13:41:10,652 ./wsems: Starting HTTP Server.
[FORCE] 2016-11-12 13:41:10,652 httpServer: Initializing the ThingWorx REST interface.
[INFO ] 2016-11-12 13:41:10,652 ./wsems: Initializing the ThingWorx REST interface.
[DEBUG] 2016-11-12 13:41:10,652 httpServer: http server bound to port=8080.
[DEBUG] 2016-11-12 13:41:10,653 SDK: twWs_Create: Initializing Websocket Client for 192.168.1.36:80//Thingworx/WS
[DEBUG] 2016-11-12 13:41:10,653 SDK: twTlsClient_Create: Initializing TLS Client
[DEBUG] 2016-11-12 13:41:10,653 SDK: twApi_Initialize: Websocket Established after 0 tries
[DEBUG] 2016-11-12 13:41:10,653 SDK: subscribedPropsMgr_Initialize: Initializing subscribed properties manager
[DEBUG] 2016-11-12 13:41:10,654 jsonConfigurator::getJsonEntity: Key cert_chain not found
[DEBUG] 2016-11-12 13:41:10,654 jsonConfigurator::getJsonEntity: Key validation_criteria not found
[DEBUG] 2016-11-12 13:41:10,654 jsonConfigurator::getJsonEntity: Parent file not found
[DEBUG] 2016-11-12 13:41:10,655 jsonConfigurator::getJsonEntity: Parent file not found
[INFO ] 2016-11-12 13:41:10,655 wsEmsProxy::initialize: Initialization complete!
[INFO ] 2016-11-12 13:41:10,655 ./wsems: Starting the connection.
192.168.1.36:80-->[DEBUG] 2016-11-12 13:41:10,656 SDK: twTlsClient_Reconnect: Re-establishing SSL context
[DEBUG] 2016-11-12 13:41:10,656 SDK: twTlsClient_Connect: Connecting to server
[WARN ] 2016-11-12 13:42:10,678 Main: Unable to connect to server. Trying .booted config file
[ERROR] 2016-11-12 13:43:17,925 SDK: Error intializing socket connection. Err = 110
[ERROR] 2016-11-12 13:43:17,925 SDK: twWs_Connect: Error restarting socket. Error 110
[WARN ] 2016-11-12 13:43:22,925 WsEmsProxy::execute() : Server connection failed. Error Code: 1001
[FORCE] 2016-11-12 13:43:25,836 Main: Shutdown signal received. Restarting ....
[DEBUG] 2016-11-12 13:43:25,837 SDK: twMessage_Send: Not authenticated yet
[ERROR] 2016-11-12 13:43:25,837 SDK: twMessage_Send: Error sending Message with RequestId 1
[ERROR] 2016-11-12 13:43:25,837 SDK: twApi_UnbindThing: Error creating sending Unbind message
[DEBUG] 2016-11-12 13:43:25,837 SDK: twMessage_Delete: Deleting BIND Message: 1
terminate called without an active exception
thanks for your help
[WARN ] 2016-11-12 12:35:24,494 SDK: Creating Staging Directory at path = /opt/thingworx/tw_staging
[DEBUG] 2016-11-12 12:35:24,495 jsonConfigurator::getJsonEntity: Parent file not found
This portion is appearing because the folders specified need to actually exist at the given path, so in this case, you need to create a directory called tw_staging located at the path /opt/thingworx
I do not know if that is causing the rest of the issues with starting the EMS or not.
Usually this all happens when there is a problem with the application key or IP/port configuration:
[DEBUG] 2016-11-12 12:35:24,496 SDK: twTlsClient_Reconnect: Re-establishing SSL context
[DEBUG] 2016-11-12 12:35:24,496 SDK: twTlsClient_Connect: Connecting to server
[ERROR] 2016-11-12 12:35:25,508 SDK: twWs_Connect: Error initializing web socket. Response code: 400