Cardjour – share your business cards using Bonjour

, , , at September 8th, 2008 by 小影

BarCamp Hong Kong 2008 is so cool! Met so many interesting guys and gals, you want to add those contact, but probably you will just not getting enough cards to share!

Solution? Maybe share business cards using Bluetooth OBEX, but you will still need to pair up with each phones. How about a P2P, self-discovery business card exchange program?

Here comes Bonjour.

Bonjour, formerly Rendezvous, is Apple Inc.’s trade name for its implementation of Zeroconf, a service discovery protocol. Bonjour locates devices such as printers, as well as other computers, and the services that those devices offer on a local network using multicast Domain Name System service records.
– wikipedia

Using Bonjour, we can write servers that register services in a LAN and let clients discover them. Perfect for our purpose. So lets write a Ruby program to share VCards!

There are two bonjour libraries in Ruby: dnssd and net-mdns. dnssd is a native library and net-mdns is in pure ruby. I will use net-mdns because it is more compatible (and dnssd just keep crashing on my OSX 10.5.4).

Bonjour only handle service discovery, for file sharing, i will keep it simple and use WEBrick to serve file using HTTP.

For reading VCard, i found vpim, simple and it just work.

GUI toolkit I will use shoes from whys, it’s language is just beautiful!

This is the first version i got, currently there are no GUI. Only a gem that provide program for you to publish the VCard to LAN, and discover other users who publishing.

Installation:

You need ruby and rubygem installed. If you are using Mac OSX 10.5.4, you should be fine! Enter following commands to install:

sudo gem install vpim net-mdns
sudo gem install siuying-cardjour --source=http://gems.github.com

Usage

Publish VCard to LAN

cardjour publish [port] [description]

Share specified VCard to Bonjour.

Example:

einstein$ cardjour publish siuying.vcf
Registered Siu Ying on port 3300. Starting service.
serving at 3300 with siuying.vcf

List VCard in LAN

cardjour list

Find all VCards sharing nearby. Currently there are no way to download automatically. Please manually enter the URL. :-)

Example:

einstein:~ siuying$ cardjour list
Gathering for up to 5 seconds...
=== SIU YING on einstein.local:3300 ===
  SIU YING's Cardjour

http://einstein.local:3300/

Source

The source is distributed in MIT license. Please find it at github.

This gem is inspired by Dr Nic post on RailsCamp08 and *jour. A lot of fun stuff can be build using Bonjour!

相關文章

Post a Comment