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.

CC3000 is unable to establish socket.io connection



I am trying to establish a socket.io connection with a node.js server.  I am using this library to do so 

https://github.com/chadstachowicz/socket_io_arduino_cc3000

During the initial handshake process, the server sends the HTTP response 200 ok. 

CC3000 is able to read this response but it gets disconnected while reading the ssid. 

Does CC3000 gets disconnected after certain timeout or is there any handshake protocol I must take care of?

  • Nirmala Ranawat said:

    I am trying to establish a socket.io connection with a node.js server.  I am using this library to do so 

    https://github.com/chadstachowicz/socket_io_arduino_cc3000

    During the initial handshake process, the server sends the HTTP response 200 ok. 

    CC3000 is able to read this response but it gets disconnected while reading the ssid. 

    You are probably going to need to break this down into CC3000HostDriver API calls rather than someone's abstractions on them (unless someone else on this forum is familiar with this particular library).

    Could you elaborate on what is happening in more detail?

    If the server sends 200 then the CC3000 client has transmitted a request to the server.

    However, you say it disconnects when reading the ssid. The CC3000 would have already had to connect to an access point to transmit data to the server. So where is it reading the ssid from?

    Nirmala Ranawat said:
    Does CC3000 gets disconnected after certain timeout or is there any handshake protocol I must take care of?

    There are asynchronous events from the C3000 which inform of connectivity, such as HCI_EVNT_WLAN_UNSOL_CONNECT, HCI_EVNT_WLAN_UNSOL_DISCONNECT, HCI_EVNT_WLAN_UNSOL_DHCP. Monitoring them is useful.

  • Hi Alan,

    Sorry I meant sid of the socket connection instead of ssid.

    I have got the sid from the server now. 

    During the handshake, the client sends the following headers to the server to upgrade the first connection as websocket.

    client.print(F("GET /socket.io/1/websocket/"));
    client.print(sid);
    client.println(F(" HTTP/1.1"));
    client.print(F("Host: "));
    client.println(hostname);
    client.println(F("Origin: ArduinoSocketIOClient"));
    client.println(F("Upgrade: WebSocket")); // must be camelcase ?!
    client.println(F("Connection: Upgrade\r\n"));
     
    Here the client expects a "101" response from the server. But I am not getting this response. Does CC3000 support such websocket protocol?
  • The CC3000 supports UDP and TCP, anything built on top of them needs to be implemented on your host MCU.

    So presumably all of this is implemented on top of a TCP socket in the socket_io_arduino_cc3000 library.