I have an embedded device (ESP32) that uses an UDP socket with multicast. It is connected to a router through another wifi device that acts as an access point.
After some time (260 seconds), the socket stop receiving any data. What I understand is that the access point does some IGMP snooping but the device is dropped from the group subscription after a timeout.
What is supposed to happen to make the device not beeing dropped from multicast subscription ? I think the router is supposed to send regular membership queries but how can I know what is happening there? The router not sending those queries ? The access point not forwarding them ? The device not answering those queries ?
Yes. The router needs to periodically send IGMP query messages. Having a device that joins the group for a while, then drops out, is exactly the behavior you get when there is no device sending the query messages. Devices send an initial membership message when they join the group, so everything works for a while, but then get expired out of the group because they never send another one, at which point they appear to stop working.
Not all routers implement IGMP queriers, and it might be a feature you have to explicitly enable. If none of routers implement querier functionality, you might try running one from some host on your network -- the quereier doesn't have to be a router, that's just typically who does it. You could even add one to your ESP32 device (or better yet, use one as an IGMP querier appliance).
When query messages are being sent, you'll see them on your network using a packet capture tool, just like you see the membership messages.