couchbaselabs / photo-drop

P2P Photo Sharing app. Read more http://blog.couchbase.com/photodrop
41 stars 11 forks source link

Can anyone please tell me how the connection is established between 2 devices(Android) and how they are connected to each other after scanning QRCode #13

Closed shwetankbhardwaj closed 7 years ago

shwetankbhardwaj commented 7 years ago

Hello , I am unable to identify how the devices are connected to each other after scanning the QRCode. If you can please guide me how to connect devices before scanning QRCode or the application does it automatically. @hideki

tahmmee commented 7 years ago

The device presenting the QRCode is running a lite serve on the receiving end. It's using the QRCode as a way to broadcast it's receiving url to the senders. A sending device can scan this code to get the receivers url and set up a push replication for sending media to the receiving device.

Here is where the code is scanned, translated to a url and replication is done on the client: https://github.com/couchbaselabs/photo-drop/blob/master/ios/PhotoDrop/SendViewController.swift#L123

Meanwhile, the receiving device is just running a listener: https://github.com/couchbaselabs/photo-drop/blob/master/ios/PhotoDrop/ReceiveViewController.swift#L104