Discussion:
Java servlet, comet, long polling, websocket: I am consused !!
(too old to reply)
sl@exabyte
2012-11-10 14:06:38 UTC
Permalink
I have been reading the above topics for several days, and now utterly
confused.

I am trying to to put a server program for char room feature on my web
site. To make the server program more efficient I am thinking of using
sockets.

For the client end, I would to use socket if I can (otherwise AJAX).

At the server end, PHP or java daemon.

My questions:

1.
a) For the front end, can I use java servlet ? I understand that websocket
is not generally supported.
b) Is java servlet supported by browsers generally ?

2.
I discover that there are comet, long polling, websocket. I am very confused
now.

Can some experts discuss somewhat of all these options ?

Thanks.
markspace
2012-11-10 16:09:01 UTC
Permalink
Post by ***@exabyte
a) For the front end, can I use java servlet ?
No. Servlets are server side technology.
Post by ***@exabyte
b) Is java servlet supported by browsers generally ?
Never. Servlets are a server side technology.

However, look at Java applets:
<http://docs.oracle.com/javase/tutorial/deployment/applet/>

All GUI browsers on Mac, Linux and Windows that I know of support Java
applets. Android doesn't: use an app. iOS doesn't: use their ecosystem.
sl@exabyte
2012-11-10 16:21:05 UTC
Permalink
Post by markspace
Post by ***@exabyte
a) For the front end, can I use java servlet ?
No. Servlets are server side technology.
Post by ***@exabyte
b) Is java servlet supported by browsers generally ?
Never. Servlets are a server side technology.
<http://docs.oracle.com/javase/tutorial/deployment/applet/>
All GUI browsers on Mac, Linux and Windows that I know of support Java
applets. Android doesn't: use an app. iOS doesn't: use their
ecosystem.
My apology, 'java servlet' should be 'java applet'.

I think coding in java applet allows access to sockets.

Thanks.
markspace
2012-11-10 16:31:52 UTC
Permalink
Post by ***@exabyte
I think coding in java applet allows access to sockets.
Yes it does.

<http://docs.oracle.com/javase/tutorial/networking/sockets/index.html>

<http://docs.oracle.com/javase/7/docs/api/java/net/Socket.html>

<http://docs.oracle.com/javase/7/docs/api/java/net/ServerSocket.html>
William Bonawentura
2012-11-12 06:38:12 UTC
Permalink
Post by ***@exabyte
I think coding in java applet allows access to sockets.
Except clients behind http proxy.
sl@exabyte
2012-11-12 14:13:06 UTC
Permalink
Post by William Bonawentura
Post by ***@exabyte
I think coding in java applet allows access to sockets.
Except clients behind http proxy.
Thanks for your info. I have heard of proxy server, but not bothered with it
so far.

I did some 'google'ing on proxy server. My current understanding is the
proxy server may block the communication port. So to enable the
administrator needs to give permission to use this port.

Would MSN have the same problem ? Thanks for your guide.
Arne Vajhøj
2012-12-11 03:20:30 UTC
Permalink
Post by ***@exabyte
Post by markspace
<http://docs.oracle.com/javase/tutorial/deployment/applet/>
All GUI browsers on Mac, Linux and Windows that I know of support Java
applets. Android doesn't: use an app. iOS doesn't: use their ecosystem.
My apology, 'java servlet' should be 'java applet'.
That is a bloody big difference.
Post by ***@exabyte
I think coding in java applet allows access to sockets.
It does.

Server side is more tricky.

Either a standalone server/daemon program or a full
Java EE application-server with a JCA inbound adapter.

And you need to get through all the firewalls, which may
be easy or may be impossible.

Arne
Kevin McMurtrie
2012-11-10 21:23:41 UTC
Permalink
Post by ***@exabyte
I have been reading the above topics for several days, and now utterly
confused.
I am trying to to put a server program for char room feature on my web
site. To make the server program more efficient I am thinking of using
sockets.
For the client end, I would to use socket if I can (otherwise AJAX).
At the server end, PHP or java daemon.
1.
a) For the front end, can I use java servlet ? I understand that websocket
is not generally supported.
b) Is java servlet supported by browsers generally ?
2.
I discover that there are comet, long polling, websocket. I am very confused
now.
Can some experts discuss somewhat of all these options ?
Thanks.
I'm using WebSockets with Jetty. It generally works well for two-way
text messaging and it doesn't interfere with REST/Servlet APIs. Recent
but important features, like ping/pong and different message types,
aren't supported by browsers. There's also zero error handling defined
so you'll need to work that in.

Tomcat has experimental support for WebSockets but I recommend Jetty
instead.
--
I will not see posts from Google because I must filter them as spam
sl@exabyte
2012-11-11 13:30:28 UTC
Permalink
Post by Kevin McMurtrie
Post by ***@exabyte
I have been reading the above topics for several days, and now
utterly confused.
I am trying to to put a server program for char room feature on my
web site. To make the server program more efficient I am thinking of
using sockets.
For the client end, I would to use socket if I can (otherwise AJAX).
At the server end, PHP or java daemon.
1.
a) For the front end, can I use java servlet ? I understand that
websocket is not generally supported.
b) Is java servlet supported by browsers generally ?
2.
I discover that there are comet, long polling, websocket. I am very
confused now.
Can some experts discuss somewhat of all these options ?
Thanks.
I'm using WebSockets with Jetty. It generally works well for two-way
text messaging and it doesn't interfere with REST/Servlet APIs.
Recent but important features, like ping/pong and different message
types, aren't supported by browsers. There's also zero error
handling defined so you'll need to work that in.
Tomcat has experimental support for WebSockets but I recommend Jetty
instead.
Just curious, have you thought about using javacript with java applet ?

If yes, what made you choose WebSockets with jetty ?

Thanks.
Kevin McMurtrie
2012-11-13 08:44:57 UTC
Permalink
Post by ***@exabyte
Post by Kevin McMurtrie
Post by ***@exabyte
I have been reading the above topics for several days, and now
utterly confused.
I am trying to to put a server program for char room feature on my
web site. To make the server program more efficient I am thinking of
using sockets.
For the client end, I would to use socket if I can (otherwise AJAX).
At the server end, PHP or java daemon.
1.
a) For the front end, can I use java servlet ? I understand that
websocket is not generally supported.
b) Is java servlet supported by browsers generally ?
2.
I discover that there are comet, long polling, websocket. I am very
confused now.
Can some experts discuss somewhat of all these options ?
Thanks.
I'm using WebSockets with Jetty. It generally works well for two-way
text messaging and it doesn't interfere with REST/Servlet APIs.
Recent but important features, like ping/pong and different message
types, aren't supported by browsers. There's also zero error
handling defined so you'll need to work that in.
Tomcat has experimental support for WebSockets but I recommend Jetty
instead.
Just curious, have you thought about using javacript with java applet ?
If yes, what made you choose WebSockets with jetty ?
Thanks.
Applets are uncommon and so are developers for them. Sun screwed up the
Applet and GUI APIs over and over again right when Applets were needed.
HTML5 features create interactive GUIs far more easily and efficiently
than anything from Sun or Oracle.

WebSockets were chosen because they were a very simple way to provide
realtime two-way communications between client and server.

Jetty was chosen because it appears that it receives aggressive
refactoring to keep the code lean and clean. WebSocket support is
mature and cleanly integrated. Jetty also has clear layering that makes
it possible for unit tests to build a mini environment for invoking
Servlets. The downside is that configuration documentation is
incomplete.
--
I will not see posts from Google because I must filter them as spam
sl@exabyte
2012-11-11 13:37:15 UTC
Permalink
Post by Kevin McMurtrie
I'm using WebSockets with Jetty. It generally works well for two-way
text messaging and it doesn't interfere with REST/Servlet APIs.
Recent but important features, like ping/pong and different message
types, aren't supported by browsers. There's also zero error
handling defined so you'll need to work that in.
Tomcat has experimental support for WebSockets but I recommend Jetty
instead.
Just thinking. If javascript can communicate with java applet (which can
access sockets), why bother to have websocket ?

Forgive me if this is a stupid question.
Arne Vajhøj
2012-12-11 03:24:25 UTC
Permalink
Post by ***@exabyte
Just thinking. If javascript can communicate with java applet (which can
access sockets), why bother to have websocket ?
Forgive me if this is a stupid question.
Actually it is a pretty good question.

Java applets are out of fashion - JavaScript is in fashion.

There are or will soon be 1 billion smartphones with browsers
without applet support.

A Java-JavaScript solution is more complex than a pure
JavaScript solution.

But that said, then I still consider the Java applet
solution to be a perfectly viable solution that must be
considered.

Arne

jebblue
2012-11-23 17:26:14 UTC
Permalink
Post by Kevin McMurtrie
Post by ***@exabyte
I have been reading the above topics for several days, and now utterly
confused.
I am trying to to put a server program for char room feature on my web
site. To make the server program more efficient I am thinking of using
sockets.
For the client end, I would to use socket if I can (otherwise AJAX).
At the server end, PHP or java daemon.
1.
a) For the front end, can I use java servlet ? I understand that websocket
is not generally supported.
b) Is java servlet supported by browsers generally ?
2.
I discover that there are comet, long polling, websocket. I am very confused
now.
Can some experts discuss somewhat of all these options ?
Thanks.
I'm using WebSockets with Jetty. It generally works well for two-way
text messaging and it doesn't interfere with REST/Servlet APIs. Recent
but important features, like ping/pong and different message types,
aren't supported by browsers. There's also zero error handling defined
so you'll need to work that in.
Tomcat has experimental support for WebSockets but I recommend Jetty
instead.
Jetty doesn't even have a clean start/stop CLI interface like
Tomcat has had all along. Tomcat is the basis for all major
Enterprise Java web servers.
Kevin McMurtrie
2012-11-29 05:02:59 UTC
Permalink
Post by jebblue
Post by Kevin McMurtrie
Post by ***@exabyte
I have been reading the above topics for several days, and now utterly
confused.
I am trying to to put a server program for char room feature on my web
site. To make the server program more efficient I am thinking of using
sockets.
For the client end, I would to use socket if I can (otherwise AJAX).
At the server end, PHP or java daemon.
1.
a) For the front end, can I use java servlet ? I understand that websocket
is not generally supported.
b) Is java servlet supported by browsers generally ?
2.
I discover that there are comet, long polling, websocket. I am very confused
now.
Can some experts discuss somewhat of all these options ?
Thanks.
I'm using WebSockets with Jetty. It generally works well for two-way
text messaging and it doesn't interfere with REST/Servlet APIs. Recent
but important features, like ping/pong and different message types,
aren't supported by browsers. There's also zero error handling defined
so you'll need to work that in.
Tomcat has experimental support for WebSockets but I recommend Jetty
instead.
Jetty doesn't even have a clean start/stop CLI interface like
Tomcat has had all along. Tomcat is the basis for all major
Enterprise Java web servers.
Why the totally off-topic reply about the start/stop procedure?

/opt/jetty/bin/jetty.sh stop
/opt/jetty/bin/jetty.sh start

Or use the init.d scripts. That looks a lot like Tomcat.

I recommend using the server best supports the features you need.
Software developers aren't paid lots of money to make decisions based on
FUD. There's good reason for Restlet, Jetty, Resin, Tomcat, and other
engines existing.
--
I will not see posts from Google because I must filter them as spam
jebblue
2012-12-07 06:09:41 UTC
Permalink
Post by Kevin McMurtrie
Post by jebblue
Post by Kevin McMurtrie
Post by ***@exabyte
I have been reading the above topics for several days, and now utterly
confused.
I am trying to to put a server program for char room feature on my web
site. To make the server program more efficient I am thinking of using
sockets.
For the client end, I would to use socket if I can (otherwise AJAX).
At the server end, PHP or java daemon.
1.
a) For the front end, can I use java servlet ? I understand that websocket
is not generally supported.
b) Is java servlet supported by browsers generally ?
2.
I discover that there are comet, long polling, websocket. I am very confused
now.
Can some experts discuss somewhat of all these options ?
Thanks.
I'm using WebSockets with Jetty. It generally works well for two-way
text messaging and it doesn't interfere with REST/Servlet APIs. Recent
but important features, like ping/pong and different message types,
aren't supported by browsers. There's also zero error handling defined
so you'll need to work that in.
Tomcat has experimental support for WebSockets but I recommend Jetty
instead.
Jetty doesn't even have a clean start/stop CLI interface like
Tomcat has had all along. Tomcat is the basis for all major
Enterprise Java web servers.
Why the totally off-topic reply about the start/stop procedure?
Cars or the moon would be off-topic.
Post by Kevin McMurtrie
/opt/jetty/bin/jetty.sh stop
/opt/jetty/bin/jetty.sh start
Or use the init.d scripts. That looks a lot like Tomcat.
Thanks, guess I didn't look far enough. Tomcat is still the basis of
every major enterprise Java platform.
Post by Kevin McMurtrie
I recommend using the server best supports the features you need.
Software developers aren't paid lots of money to make decisions based on
FUD. There's good reason for Restlet, Jetty, Resin, Tomcat, and other
engines existing.
FUD? Nope. Mistake yes, FUD no, not at all. When WebSphere or
WebLogic decide to switch to Jetty I'll look at it again.
Arved Sandstrom
2012-12-07 10:43:34 UTC
Permalink
[ SNIP ]
Post by jebblue
Post by Kevin McMurtrie
I recommend using the server best supports the features you need.
Software developers aren't paid lots of money to make decisions based on
FUD. There's good reason for Restlet, Jetty, Resin, Tomcat, and other
engines existing.
FUD? Nope. Mistake yes, FUD no, not at all. When WebSphere or
WebLogic decide to switch to Jetty I'll look at it again.
I'm with Kevin on this one. And bear in mind, when you say "WebSphere"
or "WebLogic" it's not like you've got this dedicated team of web
container experts, with each app server development staff, that
constantly evaluates servlet containers and gets their decisions quickly
acted upon.

In practice the resources allocated for software development on a major
JEE app server are less than you might think. Most are probably either
fixing bugs or designing/implementing new features (which latter is
driven by the marketers). If an included/embedded web/servlet container
is cutting it, and that original choice probably came down to one or a
small handful of people way back when (so why do they know more than
you, exactly?), and the cost of *change* is probably not justifiable for
incremental improvements achieved by using another container, why do you
think that what a major app server uses gives you any major guidance at all?

Other than that what they use is good for them. It's possibly not the
_best_ for them at any given time. It's very possibly not the best
choice for anyone else's requirements, although you can expect it to be
adequate.

AHS
Arne Vajhøj
2012-12-09 23:42:59 UTC
Permalink
Post by jebblue
Post by Kevin McMurtrie
/opt/jetty/bin/jetty.sh stop
/opt/jetty/bin/jetty.sh start
Or use the init.d scripts. That looks a lot like Tomcat.
Thanks, guess I didn't look far enough.
Given that it is in the same location as for Tomcat, then
it appears that you have not been looking at all.
Post by jebblue
Tomcat is still the basis of
every major enterprise Java platform.
Still not.
Post by jebblue
Post by Kevin McMurtrie
I recommend using the server best supports the features you need.
Software developers aren't paid lots of money to make decisions based on
FUD. There's good reason for Restlet, Jetty, Resin, Tomcat, and other
engines existing.
FUD? Nope. Mistake yes, FUD no, not at all. When WebSphere or
WebLogic decide to switch to Jetty I'll look at it again.
They probably prefer their own.

But heard of a small company called Google?

They use Jetty!

Arne
Silvio
2012-11-29 10:30:37 UTC
Permalink
Post by jebblue
Post by Kevin McMurtrie
Post by ***@exabyte
I have been reading the above topics for several days, and now utterly
confused.
I am trying to to put a server program for char room feature on my web
site. To make the server program more efficient I am thinking of using
sockets.
For the client end, I would to use socket if I can (otherwise AJAX).
At the server end, PHP or java daemon.
1.
a) For the front end, can I use java servlet ? I understand that websocket
is not generally supported.
b) Is java servlet supported by browsers generally ?
2.
I discover that there are comet, long polling, websocket. I am very confused
now.
Can some experts discuss somewhat of all these options ?
Thanks.
I'm using WebSockets with Jetty. It generally works well for two-way
text messaging and it doesn't interfere with REST/Servlet APIs. Recent
but important features, like ping/pong and different message types,
aren't supported by browsers. There's also zero error handling defined
so you'll need to work that in.
Tomcat has experimental support for WebSockets but I recommend Jetty
instead.
Jetty doesn't even have a clean start/stop CLI interface like
Tomcat has had all along. Tomcat is the basis for all major
Enterprise Java web servers.
That is utter nonsense.
jebblue
2012-12-07 06:12:18 UTC
Permalink
Post by Silvio
Post by jebblue
Post by Kevin McMurtrie
Post by ***@exabyte
I have been reading the above topics for several days, and now utterly
confused.
I am trying to to put a server program for char room feature on my web
site. To make the server program more efficient I am thinking of using
sockets.
For the client end, I would to use socket if I can (otherwise AJAX).
At the server end, PHP or java daemon.
1.
a) For the front end, can I use java servlet ? I understand that websocket
is not generally supported.
b) Is java servlet supported by browsers generally ?
2.
I discover that there are comet, long polling, websocket. I am very confused
now.
Can some experts discuss somewhat of all these options ?
Thanks.
I'm using WebSockets with Jetty. It generally works well for two-way
text messaging and it doesn't interfere with REST/Servlet APIs. Recent
but important features, like ping/pong and different message types,
aren't supported by browsers. There's also zero error handling defined
so you'll need to work that in.
Tomcat has experimental support for WebSockets but I recommend Jetty
instead.
Jetty doesn't even have a clean start/stop CLI interface like
Tomcat has had all along. Tomcat is the basis for all major
Enterprise Java web servers.
That is utter nonsense.
No actually, read the README.txt file at the top level. It says
run it as a jar. Kevin had the right answer, use bin/jetty.sh
and supply one of the options such as start or stop.
Roedy Green
2012-12-09 18:01:37 UTC
Permalink
Post by ***@exabyte
b) Is java servlet supported by browsers generally ?
Servlets run on the Server. To the browser client they just look like
static web pages. You can run some intelligence such as Ajax, Applets
or JWS at the client. Then you can send any message format you want
back and forth.

see http://mindprod.com/jgloss/servletwomb.html

For very high speed communication, you use UDP packets. The catch is,
there is no guaranteed delivery. But often that may not matter if all
you are doing is apprising each other of current state.

See http://mindprod.com/jgloss/udp.html
--
Roedy Green Canadian Mind Products http://mindprod.com
Students who hire or con others to do their homework are as foolish
as couch potatoes who hire others to go to the gym for them.
Arne Vajhøj
2012-12-09 23:30:23 UTC
Permalink
Post by jebblue
Post by Kevin McMurtrie
I'm using WebSockets with Jetty. It generally works well for two-way
text messaging and it doesn't interfere with REST/Servlet APIs. Recent
but important features, like ping/pong and different message types,
aren't supported by browsers. There's also zero error handling defined
so you'll need to work that in.
Tomcat has experimental support for WebSockets but I recommend Jetty
instead.
Jetty doesn't even have a clean start/stop CLI interface like
Tomcat has had all along.
No.

Jetty comes with CLI script to start/stop.
Post by jebblue
Tomcat is the basis for all major
Enterprise Java web servers.
No.

WebSphere and WebLogic come with own.

JBoss uses Tomcat and Glassfish uses a modified Tomcat.

Arne
Loading...