A Chat Application in Lift

9 years 12 months ago
A Chat Application in Lift
s the HTTP request–response cycle rather than wrapping HTTP concepts in APIs. This means you put HTML element definition and action in the same place: var name = "" SHtml.text(name, s => name = s) This example creates an <input type= "text" value=""/> tag and associates it with the function that sets the variable name to the value the user enters, whether submitted via Ajax or via a normal HTTP GET or POST. The advantages of Lift’s approach are numerous, including increased security through randomly assigned HTML element names, enhanced maintainability, and unification between Ajax and normal HTTP. Here, we show how to build a multiuser, realtime chat application in Lift and discuss Scala’s language features that make Lift possible. The application provides a single chat server that takes chat messages and redistributes the messages out to all listeners. But before we present the code for the chat application, let’s first briefly discuss S...
David Pollak, Steve Vinoski
Added 28 Jan 2011
Updated 28 Jan 2011
Type Journal
Year 2010
Authors David Pollak, Steve Vinoski
Comments (0)