• Post Reply Bookmark Topic Watch Topic
  • New Topic

WebSockets with Servlets

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a bit confused as to which Servlet specification version has WebSocket support and what is the Java EE version for it? Does Servlet spec 3.1 requires a Java EE 7 container? The reason being that I want to use WebSockets in one of my WebApp and I'm aware that WebSocket support is available only with Servlet spec 3.1.

Does the Java EE 7 container like Glassfish 4 or Tomcat 7 require Java 7? Can't it run with Java 6?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat 7 is a JEE 6 container; Tomcat 8 will support JEE 7. However, Tomcat 7 does support WebSockets if you use Java 7. See http://tomcat.apache.org/whichversion.html.
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that. Are WebSockets communication between client and server is always asynchronous?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are plenty of WebSocket tutorials on the web that can answer your basic questions.
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:There are plenty of WebSocket tutorials on the web that can answer your basic questions.


It was actually one of those poorly written tutorials that actually got me confused. That is the reason why in the first place, I posted my question here. If I have to trust Wikipedia, WebSockets are by default not asynchronous. I just wanted to know from fellow ranchers if they have used WebSockets in asynchronous mode?
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Harry wrote: If I have to trust Wikipedia, WebSockets are by default not asynchronous.


They are not designed to be synchronous, only asynchronous otherwise the full duplex communication would be faked. It doesn't make sense to want to use them synchronously. It's really like asking if you can use a boat in the air instead of in water. You could make some modifications to make it happen but what would be the point of that.

Which statement on Wikipedia suggests that "WebSockets are by default not asynchronous."?
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
E Armitage wrote:
They are not designed to be synchronous, only asynchronous otherwise the full duplex communication would be faked. It doesn't make sense to want to use them synchronously. It's really like asking if you can use a boat in the air instead of in water. You could make some modifications to make it happen but what would be the point of that.

Which statement on Wikipedia suggests that "WebSockets are by default not asynchronous."?


Wikipedia just does not say that it is asynchronous. It actually does not say anything about this. What you say makes sense to me. If I think about a full duplex communication mode, like a land line telephone, it justifies to me that WebSockets in nature is asynchronous.
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's still a stretch to conclude that Wikipedia suggests that Websockets are by default not asynchronous.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!