I was interested in WebSocket technology since last year. I have a posting related to WebSocket using Grizzly implementation. Since then, WebSocket becomes a part of JEE 7 release and Glassfish 4.0 with JEE 7 has been released. There are tons of articles that explains what’s changed in JEE 7 and how to start using JEE 7.
In this posting, I’d like to briefly discuss my experience with WebSocket implementation in JEE 7.
- Very simple : using @ annotation, I can declare POJO into WebSocket Server/Client Endpoint really easiy.
- There is a way of creating a WebSocket Server Endpoint without using @ annotation.
- It seems I can not use both in one project. Programmatic WebSocket implementation overwrites the annotation implementation.
- WebSocket URI gave me a hard time. After I figure it out, it is obvious. However, when I was in it, I really didn’t see. It took me a while to realize those WebSocket sample codes does not specify the webcontext name. This is critical piece. I was struggled with “undefine” error.
- ws://domain:port#/webcontext(project name)/serverendpoint
Even though my WebSocket chat application is very simple application, I found it much easier to implement – compare with Grizzly implementation.
Web is evolving so fast and new ideas are keep pouring out. I think WebSocket will be very useful technology in terms of replacing point to point messaging. Especially, the connection has to be maintained constantly. One application that I used to maintain uses applet to satisfy this requirement. I think replacing an applet with WebSocket will be beneficial.
I presented this topic to my colleagues in the company Lunch & Learn session. Here is my presentation using Prezi.
Original Prezi Link HERE.
Source Code at GitHub is HERE.