cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Problemwhile connecting with raspberry pi

ar-21
1-Newbie

Problemwhile connecting with raspberry pi

When i run wsems on raspberry i got error

[INFO ] 2016-09-23 06:17:57,350 ./wsems: Using config file: /home/pi/microserver/etc/config.json

[FORCE] 2016-09-23 06:17:57,351 ./wsems: Starting up ....

[TRACE] 2016-09-23 06:17:57,351 jsonConfigurator::getString: Key = audit_target, Parent = logger

[TRACE] 2016-09-23 06:17:57,351 jsonConfigurator::getValueByType: Key audit_target not found

[TRACE] 2016-09-23 06:17:57,352 jsonConfigurator::getString: Key = publish_directory, Parent = logger

[TRACE] 2016-09-23 06:17:57,352 jsonConfigurator::getValueByType: Key publish_directory not found

[TRACE] 2016-09-23 06:17:57,352 jsonConfigurator::getUnsignedInteger: Key = max_file_storage, Parent = logger

[TRACE] 2016-09-23 06:17:57,352 jsonConfigurator::getValueByType: Key max_file_storage not found

[TRACE] 2016-09-23 06:17:57,352 jsonConfigurator::getString: Key = publish_level, Parent = logger

[TRACE] 2016-09-23 06:17:57,352 jsonConfigurator::getValueByType: Key publish_level not found

[TRACE] 2016-09-23 06:17:57,352 jsonConfigurator::getBoolean: Key = auto_flush, Parent = logger

[TRACE] 2016-09-23 06:17:57,353 jsonConfigurator::getValueByType: Key auto_flush not found

[FORCE] 2016-09-23 06:17:57,354 ./wsems: Initializing EMS ....

[FORCE] 2016-09-23 06:17:57,354 main: Using config file /home/pi/microserver/etc/config.json

[INFO ] 2016-09-23 06:17:57,355 ./wsems: Creating the WsEms proxy.

[TRACE] 2016-09-23 06:17:57,356 wsEmsProxy::wsEmsProxy: Constructor called

[INFO ] 2016-09-23 06:17:57,357 ./wsems: Starting HTTP Server.

[TRACE] 2016-09-23 06:17:57,358 jsonConfigurator::getInteger: Key = port, Parent = http_server

54.250.152.92:80-->[TRACE] 2016-09-23 06:17:57,359 jsonConfigurator::getValueByType: Parent http_server not found

[TRACE] 2016-09-23 06:17:57,360 jsonConfigurator::getString: Key = host, Parent = http_server

[TRACE] 2016-09-23 06:17:57,360 jsonConfigurator::getValueByType: Parent http_server not found

[TRACE] 2016-09-23 06:17:57,361 jsonConfigurator::getBoolean: Key = ssl, Parent = http_server

[TRACE] 2016-09-23 06:17:57,361 jsonConfigurator::getValueByType: Parent http_server not found

[TRACE] 2016-09-23 06:17:57,362 jsonConfigurator::getString: Key = certificate, Parent = http_server

[TRACE] 2016-09-23 06:17:57,362 jsonConfigurator::getValueByType: Parent http_server not found

[TRACE] 2016-09-23 06:17:57,363 jsonConfigurator::getBoolean: Key = authenticate, Parent = http_server

[TRACE] 2016-09-23 06:17:57,364 jsonConfigurator::getValueByType: Parent http_server not found

[TRACE] 2016-09-23 06:17:57,364 jsonConfigurator::getInteger: Key = content_read_timeout, Parent = http_server

[TRACE] 2016-09-23 06:17:57,365 jsonConfigurator::getValueByType: Parent http_server not found

[INFO ] 2016-09-23 06:17:57,365 ./wsems: Initializing the ThingWorx REST interface.

[TRACE] 2016-09-23 06:17:57,366 wsEmsProxy::initialize: Method entered

[TRACE] 2016-09-23 06:17:57,366 jsonConfigurator::getString: starting http server port=er

[FORCE] 2016-09-23 06:17:57,366 httpServer: starting http server port=8000

[TRACE] 2016-09-23 06:17:57,367 jsonConfigurator::getBoolean: Key = verbose, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,367 jsonConfigurator::getString: Key = encryption, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,367 jsonConfigurator::getString: Key = user, Parent =

[TRACE] 2016-09-23 06:17:57,367 jsonConfigurator::getValueByType: Key user not found

[TRACE] 2016-09-23 06:17:57,368 jsonConfigurator::getString: Key = password, Parent =

[TRACE] 2016-09-23 06:17:57,368 jsonConfigurator::getValueByType: Key password not found

[TRACE] 2016-09-23 06:17:57,368 jsonConfigurator::getString: Key = appkey, Parent =

[TRACE] 2016-09-23 06:17:57,368 jsonConfigurator::getString: Key = resource, Parent =

[TRACE] 2016-09-23 06:17:57,369 jsonConfigurator::getValueByType: Key resource not found

[TRACE] 2016-09-23 06:17:57,369 jsonConfigurator::getInteger: Key = port, Parent = proxy

[TRACE] 2016-09-23 06:17:57,369 jsonConfigurator::getValueByType: Parent proxy not found

[TRACE] 2016-09-23 06:17:57,369 jsonConfigurator::getString: Key = host, Parent = proxy

[TRACE] 2016-09-23 06:17:57,370 jsonConfigurator::getValueByType: Parent proxy not found

[TRACE] 2016-09-23 06:17:57,370 jsonConfigurator::getString: Key = user, Parent = proxy

[TRACE] 2016-09-23 06:17:57,370 jsonConfigurator::getValueByType: Parent proxy not found

[TRACE] 2016-09-23 06:17:57,370 jsonConfigurator::getString: Key = password, Parent = proxy

[TRACE] 2016-09-23 06:17:57,371 jsonConfigurator::getValueByType: Parent proxy not found

[TRACE] 2016-09-23 06:17:57,371 jsonConfigurator::getUnsignedInteger: Key = socket_read_timeout, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,371 jsonConfigurator::getValueByType: Key socket_read_timeout not found

[TRACE] 2016-09-23 06:17:57,371 jsonConfigurator::getUnsignedInteger: Key = frame_read_timeout, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,372 jsonConfigurator::getValueByType: Key frame_read_timeout not found

[TRACE] 2016-09-23 06:17:57,372 jsonConfigurator::getUnsignedInteger: Key = ssl_read_timeout, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,372 jsonConfigurator::getValueByType: Key ssl_read_timeout not found

[TRACE] 2016-09-23 06:17:57,373 jsonConfigurator::getUnsignedInteger: Key = msg_timeout, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,373 jsonConfigurator::getUnsignedInteger: Key = ping_rate, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,373 jsonConfigurator::getValueByType: Key ping_rate not found

[TRACE] 2016-09-23 06:17:57,373 jsonConfigurator::getUnsignedInteger: Key = pingpong_timeout, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,373 jsonConfigurator::getValueByType: Key pingpong_timeout not found

[TRACE] 2016-09-23 06:17:57,374 jsonConfigurator::getUnsignedInteger: Key = max_threads, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,374 jsonConfigurator::getValueByType: Key max_threads not found

[TRACE] 2016-09-23 06:17:57,374 jsonConfigurator::getUnsignedInteger: Key = max_msg_size, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,375 jsonConfigurator::getValueByType: Key max_msg_size not found

[TRACE] 2016-09-23 06:17:57,375 jsonConfigurator::getUnsignedInteger: Key = max_messages, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,375 jsonConfigurator::getValueByType: Key max_messages not found

[TRACE] 2016-09-23 06:17:57,375 jsonConfigurator::getBoolean: Key = verbose, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,376 jsonConfigurator::getBoolean: Key = connect_on_demand, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,376 jsonConfigurator::getValueByType: Key connect_on_demand not found

[TRACE] 2016-09-23 06:17:57,376 jsonConfigurator::getUnsignedInteger: Key = max_connect_delay, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,376 jsonConfigurator::getValueByType: Key max_connect_delay not found

[TRACE] 2016-09-23 06:17:57,377 jsonConfigurator::getUnsignedInteger: Key = connect_period, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,377 jsonConfigurator::getValueByType: Key connect_period not found

[TRACE] 2016-09-23 06:17:57,377 jsonConfigurator::getUnsignedInteger: Key = duty_cycle, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,378 jsonConfigurator::getValueByType: Key duty_cycle not found

[TRACE] 2016-09-23 06:17:57,378 jsonConfigurator::getUnsignedInteger: Key = message_idle_time, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,378 jsonConfigurator::getValueByType: Key message_idle_time not found

[TRACE] 2016-09-23 06:17:57,378 jsonConfigurator::getUnsignedInteger: Key = connect_timeout, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,379 jsonConfigurator::getValueByType: Key connect_timeout not found

[TRACE] 2016-09-23 06:17:57,379 jsonConfigurator::getUnsignedInteger: Key = connect_retry_interval, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,379 jsonConfigurator::getValueByType: Key connect_retry_interval not found

[TRACE] 2016-09-23 06:17:57,379 jsonConfigurator::getInteger: Key = connect_retries, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,380 jsonConfigurator::getValueByType: Key connect_retries not found

[TRACE] 2016-09-23 06:17:57,380 jsonConfigurator::getBoolean: Key = enabled, Parent = offline_msg_store

[TRACE] 2016-09-23 06:17:57,380 jsonConfigurator::getValueByType: Parent offline_msg_store not found

[TRACE] 2016-09-23 06:17:57,380 jsonConfigurator::getString: Key = directory, Parent = offline_msg_store

[TRACE] 2016-09-23 06:17:57,381 jsonConfigurator::getValueByType: Parent offline_msg_store not found

[TRACE] 2016-09-23 06:17:57,381 jsonConfigurator::getUnsignedInteger: Key = max_size, Parent = offline_msg_store

[TRACE] 2016-09-23 06:17:57,381 jsonConfigurator::getValueByType: Parent offline_msg_store not found

[TRACE] 2016-09-23 06:17:57,381 jsonConfigurator::getUnsignedInteger: Key = message_chunk_size, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,382 jsonConfigurator::getValueByType: Key message_chunk_size not found

[DEBUG] 2016-09-23 06:17:57,382 SDK: twWs_Create: Initializing Websocket Client for 54.250.152.92:80//Thingworx/WS

[DEBUG] 2016-09-23 06:17:57,382 SDK: twTlsClient_Create: Initializing TLS Client

[DEBUG] 2016-09-23 06:17:57,382 SDK: twApi_Initialize: Websocket Established after 0 tries

[DEBUG] 2016-09-23 06:17:57,383 SDK: subscribedPropsMgr_Initialize: Initializing subscribed properties manager

[TRACE] 2016-09-23 06:17:57,383 jsonConfigurator::getBoolean: Key = validate, Parent = certificates

[TRACE] 2016-09-23 06:17:57,383 jsonConfigurator::getBoolean: Key = deny_self_signed, Parent = certificates

[TRACE] 2016-09-23 06:17:57,383 jsonConfigurator::getValueByType: Key deny_self_signed not found

[TRACE] 2016-09-23 06:17:57,384 jsonConfigurator::getBoolean: Key = allow_self_signed, Parent = certificates

[TRACE] 2016-09-23 06:17:57,384 jsonConfigurator::getString: Key = client_cert, Parent = certificates

[TRACE] 2016-09-23 06:17:57,384 jsonConfigurator::getValueByType: Key client_cert not found

[TRACE] 2016-09-23 06:17:57,384 jsonConfigurator::getString: Key = key_file, Parent = certificates

[TRACE] 2016-09-23 06:17:57,385 jsonConfigurator::getValueByType: Key key_file not found

[TRACE] 2016-09-23 06:17:57,385 jsonConfigurator::getString: Key = key_passphrase, Parent = certificates

[TRACE] 2016-09-23 06:17:57,385 jsonConfigurator::getValueByType: Key key_passphrase not found

[DEBUG] 2016-09-23 06:17:57,386 jsonConfigurator::getJsonEntity: Key cert_chain not found

[DEBUG] 2016-09-23 06:17:57,386 jsonConfigurator::getJsonEntity: Key validation_criteria not found

[TRACE] 2016-09-23 06:17:57,386 jsonConfigurator::getString: Key = staging_dir, Parent = file

[TRACE] 2016-09-23 06:17:57,386 jsonConfigurator::getValueByType: Parent file not found

[TRACE] 2016-09-23 06:17:57,386 jsonConfigurator::getUnsignedInteger: Key = buffer_size, Parent = file

[TRACE] 2016-09-23 06:17:57,387 jsonConfigurator::getValueByType: Parent file not found

[TRACE] 2016-09-23 06:17:57,387 jsonConfigurator::getDouble: Key = max_file_size, Parent = file

[TRACE] 2016-09-23 06:17:57,387 jsonConfigurator::getValueByType: Parent file not found

[DEBUG] 2016-09-23 06:17:57,388 httpServer: Parent file not found

[DEBUG] 2016-09-23 06:17:57,388 jsonConfigurator::getJsonEntity: Parent file not found

[TRACE] 2016-09-23 06:17:57,388 SDK: twFileManager_AddVirtualDir: Adding __staging__ to vdir list

[TRACE] 2016-09-23 06:17:57,388 WsEmsProxy::bindThing: Adding Thing PiThing to binding list

[DEBUG] 2016-09-23 06:17:57,389 jsonConfigurator::getJsonEntity: Parent file not found

[INFO ] 2016-09-23 06:17:57,389 wsEmsProxy::initialize: Initialization complete!

[INFO ] 2016-09-23 06:17:57,389 ./wsems: Starting the connection.

[TRACE] 2016-09-23 06:17:57,389 jsonConfigurator::getInteger: Key = connect_retry_interval, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,390 jsonConfigurator::getValueByType: Key connect_retry_interval not found

[TRACE] 2016-09-23 06:17:57,390 jsonConfigurator::getInteger: Key = max_connect_delay, Parent = ws_connection

[TRACE] 2016-09-23 06:17:57,390 jsonConfigurator::getValueByType: Key max_connect_delay not found

[TRACE] 2016-09-23 06:17:57,390 SDK: twApi_Connect: Delaying 1 milliseconds before connecting

[DEBUG] 2016-09-23 06:17:57,391 SDK: twTlsClient_Reconnect: Re-establishing SSL context

[DEBUG] 2016-09-23 06:17:57,391 SDK: twTlsClient_Connect: Connecting to server

[TRACE] 2016-09-23 06:17:57,391 SDK: twWs_Connect: Connected to 54.250.152.92:80

[TRACE] 2016-09-23 06:17:57,392 SDK: twWs_Connect: Sent request:

GET /Thingworx/WS HTTP/1.1

User-Agent: ThingWorx C SDK

Upgrade: websocket

Connection: Upgrade

Host: 54.250.152.92

Sec-WebSocket-Version: 13

Sec-WebSocket-Key: dHKXaRxb93j55n9W9ShQKA==

Max-Frame-Size: 8192

appKey: f3606089-0bf8-4b25-938e-82e632a6f52a

[TRACE] 2016-09-23 06:17:57,663 SDK: twWs_Connect: Got Response from Server:

HTTP/1.1 101

Upgrade: websocket

Connection: upgrade

Date: Tue, 28 Mar 2017 18:31:14 GMT

[TRACE] 2016-09-23 06:17:57,664 SDK: ws_on_header_value: Header->upgrade : websocket

[TRACE] 2016-09-23 06:17:57,664 SDK: ws_on_header_value: Header->connection : upgrade

[TRACE] 2016-09-23 06:17:57,664 SDK: ws_on_header_value: Header->date : Tue, 28 Mar 2017 18:31:14 GMT

[ERROR] 2016-09-23 06:17:57,664 SDK: ws_on_headers_complete: Websocket connection failed.

[WARN ] 2016-09-23 06:17:57,665 SDK: twWs_Connect: Error in HTTP response headers. Websocket connection failed

[DEBUG] 2016-09-23 06:18:02,664 SDK: twTlsClient_Reconnect: Re-establishing SSL context

[DEBUG] 2016-09-23 06:18:02,664 SDK: twTlsClient_Connect: Connecting to server

[TRACE] 2016-09-23 06:18:02,666 SDK: twWs_Connect: Connected to 54.250.152.92:80

[TRACE] 2016-09-23 06:18:02,666 SDK: twWs_Connect: Sent request:

GET /Thingworx/WS HTTP/1.1

User-Agent: ThingWorx C SDK

Upgrade: websocket

Connection: Upgrade

Host: 54.250.152.92

Sec-WebSocket-Version: 13

Sec-WebSocket-Key: VNtY5+emBrKuIO8Qhk75RA==

Max-Frame-Size: 8192

appKey: f3606089-0bf8-4b25-938e-82e632a6f52a

[TRACE] 2016-09-23 06:18:02,950 SDK: twWs_Connect: Got Response from Server:

HTTP/1.1 101

Upgrade: websocket

Connection: upgrade

Date: Tue, 28 Mar 2017 18:31:19 GMT

[TRACE] 2016-09-23 06:18:02,951 SDK: ws_on_header_value: Header->upgrade : websocket

[TRACE] 2016-09-23 06:18:02,951 SDK: ws_on_header_value: Header->connection : upgrade

[TRACE] 2016-09-23 06:18:02,951 SDK: ws_on_header_value: Header->date : Tue, 28 Mar 2017 18:31:19 GMT

[ERROR] 2016-09-23 06:18:02,951 SDK: ws_on_headers_complete: Websocket connection failed.

[WARN ] 2016-09-23 06:18:02,952 SDK: twWs_Connect: Error in HTTP response headers. Websocket connection failed

[DEBUG] 2016-09-23 06:18:07,951 SDK: twTlsClient_Reconnect: Re-establishing SSL context

[DEBUG] 2016-09-23 06:18:07,952 SDK: twTlsClient_Connect: Connecting to server

[TRACE] 2016-09-23 06:18:07,954 SDK: twWs_Connect: Connected to 54.250.152.92:80

[TRACE] 2016-09-23 06:18:07,954 SDK: twWs_Connect: Sent request:

GET /Thingworx/WS HTTP/1.1

User-Agent: ThingWorx C SDK

Upgrade: websocket

Connection: Upgrade

Host: 54.250.152.92

Sec-WebSocket-Version: 13

Sec-WebSocket-Key: r3O99RWVqcPAecKRQpGKCQ==

Max-Frame-Size: 8192

appKey: f3606089-0bf8-4b25-938e-82e632a6f52a

[TRACE] 2016-09-23 06:18:08,231 SDK: twWs_Connect: Got Response from Server:

HTTP/1.1 101

Upgrade: websocket

Connection: upgrade

Date: Tue, 28 Mar 2017 18:31:24 GMT

[TRACE] 2016-09-23 06:18:08,231 SDK: ws_on_header_value: Header->upgrade : websocket

[TRACE] 2016-09-23 06:18:08,231 SDK: ws_on_header_value: Header->connection : upgrade

[TRACE] 2016-09-23 06:18:08,232 SDK: ws_on_header_value: Header->date : Tue, 28 Mar 2017 18:31:24 GMT

[ERROR] 2016-09-23 06:18:08,232 SDK: ws_on_headers_complete: Websocket connection failed.

[WARN ] 2016-09-23 06:18:08,232 SDK: twWs_Connect: Error in HTTP response headers. Websocket connection failed

[DEBUG] 2016-09-23 06:18:13,232 SDK: twTlsClient_Reconnect: Re-establishing SSL context

[DEBUG] 2016-09-23 06:18:13,233 SDK: twTlsClient_Connect: Connecting to server

[TRACE] 2016-09-23 06:18:13,235 SDK: twWs_Connect: Connected to 54.250.152.92:80

[TRACE] 2016-09-23 06:18:13,235 SDK: twWs_Connect: Sent request:

GET /Thingworx/WS HTTP/1.1

User-Agent: ThingWorx C SDK

Upgrade: websocket

Connection: Upgrade

Host: 54.250.152.92

Sec-WebSocket-Version: 13

Sec-WebSocket-Key: xfbg6+EaiLP6NauMK4oaOg==

Max-Frame-Size: 8192

appKey: f3606089-0bf8-4b25-938e-82e632a6f52a

5 REPLIES 5
ankigupta
5-Regular Member
(To:ar-21)

Hi Athul R​,

Have you setup ThingWorx for SSL. Are the corresponding ports open for connection.

If your Raspberry pi is Gui based opening the ThingWorx secured url from a browser to confirm its accessible.

supandey
19-Tanzanite
(To:ar-21)

Athul, have you disabled the SSL because I think by default ems would attempt SSL connection to the Thingworx server and from the error above it seems you are not using SSL currently. Could you share the config file?

ar-21
1-Newbie
(To:supandey)

Here is my config file.


{

"ws_servers":   [{

        "host": "<54.250.152.92>",

        "port": 80

    }],

"appKey":   "<f3606089-0bf8-4b25-938e-82e632a6f52a>",

"logger":   {

    "level":    "TRACE"

},

"auto_bind":    [{

        "name": "PiThing",

        "gateway":  false

    }],

"certificates": {

    "validate": false,

    "allow_self_signed":    true

},

"ws_connection":    {

    "encryption":   "none",

    "verbose":  true,

    "msg_timeout":  1000

}

}

supandey
19-Tanzanite
(To:ar-21)

Athul R wrote:

Here is my config file.


        "host": "<54.250.152.92>",

"appKey":   "<f3606089-0bf8-4b25-938e-82e632a6f52a>",

"certificates": {

    "validate": false,

    "allow_self_signed":    true

Hi Athul, just to confirm you are not using those place holder "<>" right? also you wanna disable the allow_self_signed to false instead of true since you dont have certificates as you have already set it to false.

Hope this helps.

chiwatashi
13-Aquamarine
(To:ar-21)

Hi Athul

The log message said: "Error in HTTP response headers. Websocket connection failed"


Looks like the response http header has not contained like Sec-WebSocket-Accept and so on .

Is there any reverse proxy (with writer) or anti virus soft running?

You may try to use SSL in order to avoid omitting/ rewriting "http-header".

If it is not solve the error, disable SSL and try capture network packet  to see if correct header is received or not.

*It is better to capture both TW server side and Edge side.

*tcpdump -i any -s 0 -w /tmp/pi_packet.cap(command)

Top Tags