8 years, 8 months ago.

how do I detect a disconnect?

I created a websocket server using node-webkit. The wifly connects to my network and websocket server without issues. The wifly stays connected for about a day then the wifly disconnects unexpectedly. How do I get the wifly to auto connect on a disconnect? My code consists of:


int main()
    wifly.init(); //Use DHCP
    while (!wifly.connect());
    printf("IP Address is %s\n\r", wifly.getIPAddress());

    Websocket ws("ws://");
    while (!ws.connect());

    while (1) {
        ws.send("WebSocket Hello World over Wifly");

Question relating to:

1 Answer

8 years, 8 months ago.

bool Wifly::is_connected()


return (tcp_status.read() == 1) ? true : false;


This member function may solve your problem. Hope this helps, Guenter.