Auction Sample

This sample demonstrates how to develop more complex WebSocket applications.

The application is an auction server with 3 auctions running. Users may connect to any of the auction and bid for the item. The highest bid wins. Once first user enters the auction, the auction is started (time countdown starts at the predefined time). User can bid on the item. After each bid the auction timer is set to predefined time again. The auction finishes once the predefined time runs out.

Contents

The server side utilizes one endpoint - org.glassfish.tyrus.sample.auction.AuctionEndpoint, which handles the communication for all running auctions. The relative path of this endpoint is "/auction". The application demonstrates the usage of encoders and decoders, namely org.glassfish.tyrus.sample.auction.encoders.AuctionMessageEncoder and org.glassfish.tyrus.sample.auction.decoders.AuctionMessageDecoder.

Running the Example

Run the example as follows: deploy:

$AS_MAIN/bin/asadmin start-domain
$AS_MAIN/bin/asadmin deploy --force ./target/*war

From a web browser, visit:

http://localhost:8080/sample-auction