This solution creates a multi peer auction room.
The first peer is run:
pear dev .
It and publishes an auction room id:
[info] New auction room created: 707c67d26d5b983e26cdb8bea5704380ca28b650d36964d85ccb5301dbed81e4
Other peers are run with the room id to connect to it:
pear dev . 707c67d26d5b983e26cdb8bea5704380ca28b650d36964d85ccb5301dbed81e4
Once a peer is connected to an auction room, a number of actions can be performed.
An auction can be created for an item with an initial price:
auction item01 7
Any peer can open auctions.
An auction can't have the same name as another open auction.
Peers can bid for any open auction, with the name of the item and the bid:
bid item01 9
The item must exist in an open auction.
The bid amount must be higher than the last top bid.
An item auction can be closed:
close item01
A summary of the auction is shown to all peers.
Only the author of the auction can close it.
Users can list the open auctions:
list
A help summary with examples can be shown:
help
- Validations should be added for every input data
- The solution is effemereal and peers only see the actions after they joined the auction room. I tried to add persistency in
index-persistency-unfinished.js
, but I didn't have time to finish it.