Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Java servlet, comet, long polling, websocket: I am consused !! (http://www.velocityreviews.com/forums/t954394-java-servlet-comet-long-polling-websocket-i-am-consused.html)

sl@exabyte 11-10-2012 02:06 PM

Java servlet, comet, long polling, websocket: I am consused !!
 
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 11-10-2012 04:09 PM

Re: Java servlet, comet, long polling, websocket: I am consused !!
 
On 11/10/2012 6:06 AM, sl@exabyte wrote:
> a) For the front end, can I use java servlet ?


No. Servlets are server side technology.

> 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 11-10-2012 04:21 PM

Re: Java servlet, comet, long polling, websocket: I am consused !!
 
> On 11/10/2012 6:06 AM, sl@exabyte wrote:
>> a) For the front end, can I use java servlet ?

>
> No. Servlets are server side technology.
>
>> 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.


My apology, 'java servlet' should be 'java applet'.

I think coding in java applet allows access to sockets.

Thanks.



markspace 11-10-2012 04:31 PM

Re: Java servlet, comet, long polling, websocket: I am consused !!
 
On 11/10/2012 8:21 AM, sl@exabyte wrote:java applet'.
>
> 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>



Kevin McMurtrie 11-10-2012 09:23 PM

Re: Java servlet, comet, long polling, websocket: I am consused !!
 
In article <k7ln1q$id0$1@news.albasani.net>,
"sl@exabyte" <sb5309@hotmail.com> wrote:

> 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.



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 11-11-2012 01:30 PM

Re: Java servlet, comet, long polling, websocket: I am consused !!
 
Kevin McMurtrie wrote:
> In article <k7ln1q$id0$1@news.albasani.net>,
> "sl@exabyte" <sb5309@hotmail.com> wrote:
>
>> 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.

>
>
> 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.





sl@exabyte 11-11-2012 01:37 PM

Re: Java servlet, comet, long polling, websocket: I am consused !!
 
Kevin McMurtrie wrote:
>
> 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.



William Bonawentura 11-12-2012 06:38 AM

Re: Java servlet, comet, long polling, websocket: I am consused !!
 
> I think coding in java applet allows access to sockets.

Except clients behind http proxy.

sl@exabyte 11-12-2012 02:13 PM

Re: Java servlet, comet, long polling, websocket: I am consused !!
 
William Bonawentura wrote:
>> 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.




Kevin McMurtrie 11-13-2012 08:44 AM

Re: Java servlet, comet, long polling, websocket: I am consused !!
 
In article <k7o9a4$k8q$1@news.albasani.net>,
"sl@exabyte" <sb5309@hotmail.com> wrote:

> Kevin McMurtrie wrote:
> > In article <k7ln1q$id0$1@news.albasani.net>,
> > "sl@exabyte" <sb5309@hotmail.com> wrote:
> >
> >> 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.

> >
> >
> > 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


All times are GMT. The time now is 01:46 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.