node-snapdrop icon indicating copy to clipboard operation
node-snapdrop copied to clipboard

Cross-device discovery doesn't work

Open therobbot opened this issue 3 years ago • 3 comments

I have the node server running on my Macbook pro. If I open it in a browser on the Macbook and on a handheld device by using the ip (in my case 192.168.0.258:3000) it works on both but they don't discover each other. If I open it in multiple tabs on either device, the different instances on one device discover each other, though.

therobbot avatar Aug 23 '21 05:08 therobbot

@therobbot, this should be a common problem with Snapdrop with a lots and a lots of issues on the original repo. To resolve, just try to connect after a while. This also occurs to me sometimes. For now, I can't do anything, because no one, also me, understood what's wrong.

If there is some issue resolve on the original repo, I'll update this Node version.

Bellisario avatar Oct 19 '21 14:10 Bellisario

@therobbot , I think I've hobbled together a patched version that fixes your issue.

Snapdrop is written from the assumption that the clients that are seeking to connect to each other are physically on the same LAN, BUT that lan is connected to the public internet where the snapdrop server is located. It is further assumed that the LAN is connected to the internet using NAT. Basically this means that, to the snapdrop server, it appears that all clients are originating from the same IP address.

In our case, however, the server will see unique IP addresses for each client seeking to connect to each other.

My fix is derived from this patch. This patch talks about needing a STUN server. My fix does not require any extra STUN server.

https://github.com/DrBassman/node-snapdrop/

Update: opened pull request, too.

DrBassman avatar Nov 22 '21 03:11 DrBassman

@therobbot , I think I've hobbled together a patched version that fixes your issue.

Snapdrop is written from the assumption that the clients that are seeking to connect to each other are physically on the same LAN, BUT that lan is connected to the public internet where the snapdrop server is located. It is further assumed that the LAN is connected to the internet using NAT. Basically this means that, to the snapdrop server, it appears that all clients are originating from the same IP address.

In our case, however, the server will see unique IP addresses for each client seeking to connect to each other.

My fix is derived from this patch. This patch talks about needing a STUN server. My fix does not require any extra STUN server.

https://github.com/DrBassman/node-snapdrop/

Update: opened pull request, too.

By using node index.js LAN,it works now. Thank you!

psychech avatar Nov 21 '22 02:11 psychech