require websocket and https combine example

Hi,

I am using SDK v2.6.1.

Is there any course available on DevAcademy for WebSockets?

For WebSocket i take reference of v2.6.1/zephyr/samples/net/sockets/websocket_client,

when i try to give wifi credential using wifi connect -s <ssid> -k 1 -p <password> then i have got wifi: command not found so require to give wifi credential?or how we are able to see WebSocket reference code output,

I need an example that merges WebSocket and HTTPS. Could you also provide feedback on how to merge both into a single code?

  • Hi,

    ChiragBhavsar said:
    I hope so you change ssid and password in below functon,also i used WIFI_SECURITY_TYPE_PSK for security

    I used the same wifi security type. The only changes were for wifi_ssid and wifi_password in the set_wifi_credentials_struct(). Are any other changes necessary?

    Best regards,
    Dejan

  • Hi,

    We used the Ubuntu OS, but I don't think this should matter.
    Please verify the entered SSID and password using another device.
    Additionally, delete the build folder and recreate it for the nrf7002dk_nrf5340_cpuapp board.

    I don't thing so any other change necessary,
    On our side, using the same program, we are able to connect to Wi-Fi successfully.

    once please try with this program

    HTTP.zip

    0
    *** Booting nRF Connect SDK v3.5.99-ncs1-1 ***
    [00:00:01.449,279] <inf> Lesson5_Exercise1: Connecting to Wi-Fi
    [00:00:04.007,598] <inf> wifi_mgmt_ext: Connection requested
    [00:00:06.564,605] <inf> wifi_mgmt_ext: Connection requested
    [00:00:09.121,124] <inf> wifi_mgmt_ext: Connection requested
    [00:00:11.694,519] <inf> wifi_mgmt_ext: Connection requested
    [00:00:11.782,257] <inf> Lesson5_Exercise1: Network connected
    [00:00:14.029,296] <inf> Lesson5_Exercise1: IPv4 address of HTTP server found 3.164.182.37
    [00:00:16.490,203] <inf> Lesson5_Exercise1: Connected to server
    [00:00:16.490,203] <inf> Lesson5_Exercise1: HTTP POST request
    [00:00:18.334,289] <inf> Lesson5_Exercise1: Response status: Created
    [00:00:18.334,350] <inf> Lesson5_Exercise1: Successfully acquired client ID: /709505ae-78be-4517-a3a7-495b409cc440
    [00:00:18.334,350] <inf> Lesson5_Exercise1: Closing socket: 9
    [00:00:21.110,015] <err> Lesson5_Exercise1: Cannot connect to IPv4 remote (-116)
    [00:00:21.110,443] <err> Lesson5_Exercise1: Cannot connect to echo.thingy.rocks:80
    [00:00:21.110,534] <err> Lesson5_Exercise1: No IPv4 or IPv6 connectivity

  • Hi,

    After several tries, I was not able to consistently reproduce this issue. I was able to reproduce it only ones (after around 3 minutes of waiting). Here is my log

    *** Booting nRF Connect SDK v3.5.99-ncs1-1 ***
    [00:00:02.047,607] <inf> wifi_mgmt_ext: Connection requested
    [00:00:03.627,227] <inf> wifi_mgmt_ext: Connection requested
    [00:00:03.627,410] <inf> Lesson5_Exercise1: Connecting to Wi-Fi
    [00:00:06.190,338] <inf> wifi_mgmt_ext: Connection requested
    [00:00:07.757,049] <inf> wifi_mgmt_ext: Connection requested
    ...
    [00:03:45.629,180] <inf> wifi_mgmt_ext: Connection requested
    [00:03:47.201,538] <inf> wifi_mgmt_ext: Connection requested
    [00:03:47.286,682] <inf> Lesson5_Exercise1: Network connected
    [00:03:49.312,927] <inf> Lesson5_Exercise1: IPv4 address of HTTP server found 54.240.174.114
    [00:03:49.964,233] <inf> Lesson5_Exercise1: Connected to server
    [00:03:49.964,263] <inf> Lesson5_Exercise1: HTTP POST request
    [00:03:51.367,279] <inf> Lesson5_Exercise1: Response status: Created
    [00:03:51.367,370] <inf> Lesson5_Exercise1: Successfully acquired client ID: /aa                                                                                                             313188-4331-4a72-bdfa-dacfcd1b7329
    [00:03:51.367,401] <inf> Lesson5_Exercise1: Closing socket: 9
    [00:03:53.470,916] <err> Lesson5_Exercise1: Cannot connect to IPv4 remote (-116)
    [00:03:53.471,374] <err> Lesson5_Exercise1: Cannot connect to echo.thingy.rocks:                                                                                                             80
    [00:03:53.471,466] <err> Lesson5_Exercise1: No IPv4 or IPv6 connectivity


    Other times (more than 5 times) I got just "Connection requested" as shown below

    [00:05:12.783,325] <inf> wifi_mgmt_ext: Connection requested
    [00:05:14.347,320] <inf> wifi_mgmt_ext: Connection requested
    ...


    Are you able to consistently reproduce this issue on your end?

    Best regards,
    Dejan

  • yes from my end i am able to reproduce this issue consistently,

    in your log i am able to see that you are also not able to connect with websocket

    [00:03:53.470,916] <err> Lesson5_Exercise1: Cannot connect to IPv4 remote (-116)
    [00:03:53.471,374] <err> Lesson5_Exercise1: Cannot connect to echo.thingy.rocks: 80
    [00:03:53.471,466] <err> Lesson5_Exercise1: No IPv4 or IPv6 connectivity

    If possible, please suggest changes to the code from your side so that I can implement them and try to resolve this problem.

  • Hi,

    I have managed to reproduce this issue only once. I expect for the error to be consistently reproducible. It seems that the application on my side is not able to connect to wi-fi network most of the time. 
    Can you make a minimal sample which would show the same error (which can be replicated) for us to look into?

    Best regards,
    Dejan

Related