use of org.jboss.quickstarts.websocket.model.Bidding in project quickstart by wildfly.
the class BidWebSocketEndpoint method onMessage.
// This method receives a Message that contains a command
// The Message object is "decoded" by the MessageDecoder class
@OnMessage
public void onMessage(Session session, Message message) throws IOException, EncodeException {
if (message.getCommand().equals("newBid")) {
Bidding bidding = BiddingFactory.getBidding();
bidding.addBid(new Bid(session.getId(), message.getBidValue()));
}
if (message.getCommand().equals("buyItNow")) {
Bidding bidding = BiddingFactory.getBidding();
bidding.buyItNow();
}
if (message.getCommand().equals("resetBid")) {
BiddingFactory.resetBidding();
}
notifyAllSessions(BiddingFactory.getBidding());
}