This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes EJB 3 In Action: WebSpckets and EJB 3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB 3 In Action: WebSpckets and EJB 3" Watch "EJB 3 In Action: WebSpckets and EJB 3" New topic

EJB 3 In Action: WebSpckets and EJB 3

Ralf Pantförder

Joined: May 10, 2010
Posts: 8
Hi Panda, Reza, Ryan, and Michael,

I noticed there is a chapter in the book on using WebSockets with EJB 3. My question is rather a WebSockets question than an EJB-3 question: Is there a way of enclosing a WebSocket-communication into a technical transaction, and if so, would you regard WebSockets with EJB 3 as the preferred method of implementing transactional calls over the web (as opposed to classic JAX-WS with EJB 3)?

Thanks and regards
Reza Rahman
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
WebSockets do not use transactions. However, a particular WebSocket callback can be transactional if you need it to be (on the server side). In terms of usage I would say you should use REST/JAX-RS 90% of the time. WebSocket is only applicable when you need TCP-like bidirectional stateful communication (such as chat, gaming, stock tickers, real time monitors and so on).

Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
It is sorta covered in the JavaRanch Style Guide.
subject: EJB 3 In Action: WebSpckets and EJB 3
It's not a secret anymore!