This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHCC3235MOD: WebSocket HTTP1.1 upgrade GET request using secure socket.

Part Number: LAUNCHCC3235MOD

Hello Team,

I am fairly new to TSL/SSL and pardon me if this is a very basic doubt but I am trying to connect to cloud using Websocket headers . The flow for connection as implemented on ESP32 with mbedtls library (as per my understanding) is as follows:

  1. initialize SSL context and configure and seed the entropy.
  2. parse the server root certificate.
  3. Configure as client and connect to the host using the above ssl context on port 443.
  4. Perform SSL handshake
  5. Send the following header using the mbedtls_write API. The header is as shown:

const char * request_base = ""

            "GET /endpoints/54484249/ws HTTP/1.1\r\n"

            "Host: <host_name>\r\n"

            "Upgrade: websocket\r\n"

            "Connection: Upgrade\r\n"

            "Sec-WebSocket-Key: KM3p2baQquchWOo6NKDjiIrws9Y=\r\n"

            "Sec-WebSocket-Version: 13\r\n"

            "Firmware-Ver: 3.5.0-beta.4\r\n"


            "device-wireless-mac: <MAC address>\r\n"

           6. Receive the response from the server using mbedtls_read

I want to implement an equivalent process in CC3235 to connect to the same cloud. Accordingly I took the following steps:

1. Opened a secured TCP socket by giving the IP using sl_Socket(sa->sa_family,SL_SOCK_STREAM,SL_SEC_SOCKET);

2. Set the device date and time using SNTP.

3. Set the Root CA certificate in .pem format, security mask and security method using sl_SetSockOpt API.

4. Using sl_Connect connect to the server. I get -114 initially then the second time it returns 0. Therefore, I am assuming that SSL handshake was successful.

Is this assumption correct?

5. I then send the above mentioned header to the server using sl_Send and all the bytes get transferred. Also, there is no SL_SOCKET_TX_FAILED_EVENT.

6. After sending the data to the server, I am waiting for the response, however I always get SL_ERROR_BSD_EAGAIN (-11) as the response and then it goes in faultISR().

Also after checking the server logs, it was clear that sl_Send data was not reaching the server.

As far as I have checked they are not using any websocket packets structure or websocket libraries, just sending the above buffer through secure TCP socket usingTSL.

It will be really helpful if you guys could shed some light on what is missing and should be the right approach for implementing the same in CC3235.