Book Image

Play Framework Essentials

By : Julien Richard-Foy
Book Image

Play Framework Essentials

By: Julien Richard-Foy

Overview of this book

Table of Contents (14 chapters)
Play Framework Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Manipulating data streams by combining iteratees, enumerators, and enumeratees


Well, that's enough concepts for now. Let's put this in practice by implementing a new feature in our shop application: an auction room.

The idea is to allow multiple users to bid for an item of the shop in a room where all connected users instantly see the bids of others, as depicted in the following screenshot:

An auction room for the item Play Framework Essentials. The prices offered by Alice and Bob are followed by the form at the bottom where users can make new offers

Unidirectional streaming with server-sent events

In order to instantly send a notification to all the users of an auction room when one makes a bid, we have to provide an HTTP endpoint streaming these events. We can achieve this using server-sent events. Thus, we have at least two endpoints: one to make a bid and one to get the stream of bid notifications. We actually need a third endpoint to get the HTML page showing an auction room (illustrated...