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

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

Error with Raspberry Pi

mr1
1-Newbie
1-Newbie

Error with Raspberry Pi

I am getting the upgrade error with the twc_agent executable when I try to run in Raspberry Pi. Has some one fixed it and be able to run it, any suggestions/help?

1 ACCEPTED SOLUTION

Accepted Solutions
Aanjan
9-Granite
(To:mr1)

The appKey comes from the server/ platform you are trying to connect to. Unless this is a prepackaged installation with the server information pre-configured, you would need to create a new appKey on the platform and then copy it over.

View solution in original post

12 REPLIES 12
pcheah
8-Gravel
(To:mr1)

Hi Maniappan,

It is good if you can show us the error messages in your Rasp Pi.

mr1
1-Newbie
1-Newbie
(To:pcheah)

Here is the log I get on running twc_agent :

[ERROR] 2015-11-29 17:48:09,813: ws_on_header_value: Invalid 'connection' header: Upgrade

[ERROR] 2015-11-29 17:48:09,814: ws_on_headers_complete: Websocket connection failed

[ERROR] 2015-11-29 17:48:09,815: twWs_Connect: Error trying to connect

This is coming periodically when it tries to connect.

mr1
1-Newbie
1-Newbie
(To:pcheah)

Some additional details apart from the log that I have posted previously, Pi is connected via Wifi to the modem that connects to my fiber provider via a router.

pcheah
8-Gravel
(To:mr1)

It seems like the Thingworx server is not connected. Have you modified the main.c file to change the Host name and Appkey? The file is located at home/pi/tw-c-sdk/examples/SteamSensor/src.

mr1
1-Newbie
1-Newbie
(To:pcheah)

Hi Peng,

Thanks for the reply. The documentation here at Raspberry Pi with ThingWorx C SDK | ThingWorx didn't ask me to change anything, so ran as is. If these steps are not proper do let me know proper one.

pcheah
8-Gravel
(To:mr1)

Hi Maniappan,

There is only one additional step to be made before Building the SDK, that is to modify the Main.c.

mr1
1-Newbie
1-Newbie
(To:pcheah)

Hi,

There is no configuration that I am able to do in main.c. The configuration was found in agent.properties file that is loaded when twc_agent is run. I have changed the Appkey and started it, host is pointing to the the device.cloud.thingworx.com site. I enabled DEBUG and I am getting this after the GPIO are registered. Please let know if there is some other issue here!

Maniappan.

[DEBUG] 2015-12-06 14:01:35,608: twTlsClient_Reconnect: Re-establishing SSL context

[DEBUG] 2015-12-06 14:01:35,829: twTlsClient_Connect: Connecting to server

[DEBUG] 2015-12-06 14:01:35,833: twTlsClient_Connect: TLS connection established

[TRACE] 2015-12-06 14:01:35,834: twWs_Connect: Connected to device.cloud.thingworx.com:80

[TRACE] 2015-12-06 14:01:35,834: twWs_Connect: Sent request:

GET /Thingworx/WS HTTP/1.1

User-Agent: ThingWorx C SDK

Upgrade: websocket

Connection: Upgrade

Host: device.cloud.thingworx.com

Sec-WebSocket-Version: 13

Sec-WebSocket-Key: YDbFo5YONb2bWzgAXk0+gA==

Max-Frame-Size: 8192

applicationKey: a7fdd7ab-d3ce-4313-ab93-6226ed9b7ef4

[DEBUG] 2015-12-06 14:01:36,392: HTTP Response begun

[TRACE] 2015-12-06 14:01:36,392: Header->server : Apache-Coyote/1.1

[TRACE] 2015-12-06 14:01:36,393: Header->sec-websocket-accept : j0V2dHwjmWVeJCikwBpXtBLXG4U=

[TRACE] 2015-12-06 14:01:36,393: Header->date : Sun, 06 Dec 2015 08:31:36 GMT

[TRACE] 2015-12-06 14:01:36,393: Header->connection : Upgrade

[ERROR] 2015-12-06 14:01:36,393: ws_on_header_value: Invalid 'connection' header: Upgrade

[TRACE] 2015-12-06 14:01:36,393: Header->upgrade : websocket

[ERROR] 2015-12-06 14:01:36,393: ws_on_headers_complete: Websocket connection failed

[TRACE] 2015-12-06 14:01:36,393: twWs_Connect: Parsed 193 bytes out of 193

[ERROR] 2015-12-06 14:01:36,393: twWs_Connect: Error trying to connect

[DEBUG] 2015-12-06 14:01:36,393: twTlsClient_Reconnect: Re-establishing SSL context

[DEBUG] 2015-12-06 14:01:36,610: twTlsClient_Connect: Connecting to server

[DEBUG] 2015-12-06 14:01:36,613: twTlsClient_Connect: TLS connection established

[DEBUG] 2015-12-06 14:01:41,614: twTlsClient_Reconnect: Re-establishing SSL context

[DEBUG] 2015-12-06 14:01:41,835: twTlsClient_Connect: Connecting to server

[DEBUG] 2015-12-06 14:01:41,840: twTlsClient_Connect: TLS connection established

[TRACE] 2015-12-06 14:01:41,841: twWs_Connect: Connected to device.cloud.thingworx.com:80

[TRACE] 2015-12-06 14:01:41,841: twWs_Connect: Sent request:

GET /Thingworx/WS HTTP/1.1

User-Agent: ThingWorx C SDK

Upgrade: websocket

Connection: Upgrade

Host: device.cloud.thingworx.com

Sec-WebSocket-Version: 13

Sec-WebSocket-Key: S7iOiIovHM0yx7USJvAm1w==

Max-Frame-Size: 8192

applicationKey: a7fdd7ab-d3ce-4313-ab93-6226ed9b7ef4

[DEBUG] 2015-12-06 14:01:42,367: HTTP Response begun

[TRACE] 2015-12-06 14:01:42,367: Header->server : Apache-Coyote/1.1

[TRACE] 2015-12-06 14:01:42,367: Header->sec-websocket-accept : 6QHmcIelri4vVUUMWNlv0fLhgB0=

[TRACE] 2015-12-06 14:01:42,367: Header->date : Sun, 06 Dec 2015 08:31:42 GMT

[TRACE] 2015-12-06 14:01:42,367: Header->connection : Upgrade

[ERROR] 2015-12-06 14:01:42,367: ws_on_header_value: Invalid 'connection' header: Upgrade

[TRACE] 2015-12-06 14:01:42,368: Header->upgrade : websocket

[ERROR] 2015-12-06 14:01:42,368: ws_on_headers_complete: Websocket connection failed

[TRACE] 2015-12-06 14:01:42,368: twWs_Connect: Parsed 193 bytes out of 193

[ERROR] 2015-12-06 14:01:42,368: twWs_Connect: Error trying to connect

[DEBUG] 2015-12-06 14:01:42,368: twTlsClient_Reconnect: Re-establishing SSL context

[DEBUG] 2015-12-06 14:01:42,592: twTlsClient_Connect: Connecting to server

[DEBUG] 2015-12-06 14:01:42,602: twTlsClient_Connect: TLS connection established

[DEBUG] 2015-12-06 14:01:47,603: twTlsClient_Reconnect: Re-establishing SSL context

[DEBUG] 2015-12-06 14:01:47,834: twTlsClient_Connect: Connecting to server

[DEBUG] 2015-12-06 14:01:47,837: twTlsClient_Connect: TLS connection established

Aanjan
9-Granite
(To:mr1)

Is there any proxy involved? Are you or is the server you are connecting to behind, say, a reverse proxy configuration?

mr1
1-Newbie
1-Newbie
(To:Aanjan)

I switched internet provider and now the connection is getting made(may be reverse proxy, will debug after I get connected properly to site), however I get auth error, where do I find the right AppKey?

Aanjan
9-Granite
(To:mr1)

The appKey comes from the server/ platform you are trying to connect to. Unless this is a prepackaged installation with the server information pre-configured, you would need to create a new appKey on the platform and then copy it over.

mhollenbach
5-Regular Member
(To:mr1)

Maniappan, Alternatively, if you are not trying to connect over SSL you are going to want to include the following function call before the connection is made in the main function in main.c: twApi_DisableEncryption();

Thanks to all who replied, I got it up and running yesterday. There were couple of issues, my provider is having reverse proxy, had to try with someone else. While playing around with configuration I had modified the original key and resetting back it worked.

Now to get to do some actual data generation..

Top Tags