SocketIO DAT reconnect

Hi, not sure if this is a bug or an RFE…

I recently discovered the the SocketIO DAT, at least as of 99 2019.37030, doesn’t automatically reconnect when disconnected. While the docs don’t say that it should, the TCP/IP DAT does this so I figured that expecting parity was reasonable :slight_smile:

I tested the callbacks and the onClose() method reliably gets called so I was able to implement it manually for my project. However I wanted to mention the state of the functionality, and get an idea of whether this is considered a bug or if it’s actually an RFE to either implement, expose a reconnect option as a toggle, and possibly also the reconnect interval as well. Thanks!

1 Like

Hi @mattfelsen, could you try the 2020.20k official builds. 2019.37030 was the previous experimental from last year and a) it was the first experimental build with the most bugs b) the SocketIO DAT was new and it has a year of improvements now.

If you have a file or can reproduce it in 2020.25380, let us know.

1 Like

Hi Ben. I just tried on 2020.23680 experimental and 2020.25380 official and I’m seeing the same behavior. Clicking the reset button works, but killing & restarting the server doesn’t result in the client reconnecting.

The server I’m using is super minimal:

// test-io-server.js

// Create the socket server
const PORT = 3000;
var socket = require('socket.io')(PORT);
socket.on('connection', function(client) {

	console.log('Client connected')

    // Listen for test and disconnect events
    client.on('disconnect', onDisconnect);

    // Handle a disconnection from the client
    function onDisconnect() {
        console.log('Received: disconnect event from client: ' + client.id);
        client.removeListener('disconnect', onDisconnect);
    }
});

Adapted from this gist: