Java Web Application sending JSON messages through WebSocket to HTML5 browser application for real time push by Lucas Jellema
By Juergenkress-Oracle on Jul 20, 2015
The specific use case that is implemented is a simple web dashboard to monitor a movie theater: the current number of people in each of the four rooms of this movie theater is observed. The REST service receives the actual spectator count and through the two web socket interactions, this count ends up in the browser and in the visual presentation.
Note: for the use case presented in this article, a somewhat simpler solution would be possible using Server Sent Events (SSE) – a simpler and lighter weight approach than the use of web sockets. SSE is uni-directional (server to client push only) and that of course is exactly what I am doing in this particular example.
The steps will be:
· Implement the REST service to handle json payloads in HTTP Post requests
· Implement the WebSocket endpoint
· Interact from REST service endpoint with WebSocket (endpoint)
The starting point is a basic Java EE web application – with no special setup in web.xml or other files.
The final application looks like this: For JDeveloper 12c users: Read the complete article here.
For regular information become a member in the WebLogic Partner Community please visit: http://www.oracle.com/partners/goto/wls-emea ( OPN account required). If you need support with your account please contact the Oracle Partner Business Center.