Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Java servlet, comet, long polling, websocket: I am consused !!

Reply
Thread Tools

Java servlet, comet, long polling, websocket: I am consused !!

 
 
sl@exabyte
Guest
Posts: n/a
 
      11-10-2012
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.


 
Reply With Quote
 
 
 
 
markspace
Guest
Posts: n/a
 
      11-10-2012
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.


 
Reply With Quote
 
 
 
 
sl@exabyte
Guest
Posts: n/a
 
      11-10-2012
> 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.


 
Reply With Quote
 
markspace
Guest
Posts: n/a
 
      11-10-2012
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>


 
Reply With Quote
 
Kevin McMurtrie
Guest
Posts: n/a
 
      11-10-2012
In article <k7ln1q$id0$(E-Mail Removed)>,
"sl@exabyte" <(E-Mail Removed)> 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
 
Reply With Quote
 
sl@exabyte
Guest
Posts: n/a
 
      11-11-2012
Kevin McMurtrie wrote:
> In article <k7ln1q$id0$(E-Mail Removed)>,
> "sl@exabyte" <(E-Mail Removed)> 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.




 
Reply With Quote
 
sl@exabyte
Guest
Posts: n/a
 
      11-11-2012
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.


 
Reply With Quote
 
William Bonawentura
Guest
Posts: n/a
 
      11-12-2012
> I think coding in java applet allows access to sockets.

Except clients behind http proxy.
 
Reply With Quote
 
sl@exabyte
Guest
Posts: n/a
 
      11-12-2012
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.



 
Reply With Quote
 
Kevin McMurtrie
Guest
Posts: n/a
 
      11-13-2012
In article <k7o9a4$k8q$(E-Mail Removed)>,
"sl@exabyte" <(E-Mail Removed)> wrote:

> Kevin McMurtrie wrote:
> > In article <k7ln1q$id0$(E-Mail Removed)>,
> > "sl@exabyte" <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Having compilation error: no match for call to (const __gnu_cxx::hash<long long int>) (const long long int&) veryhotsausage C++ 1 07-04-2008 05:41 PM
Use of Long and Long Long Bart C C Programming 27 01-15-2008 05:27 AM
long long and long Mathieu Dutour C Programming 4 07-24-2007 11:15 AM
unsigned long long int to long double Daniel Rudy C Programming 5 09-20-2005 02:37 AM
Assigning unsigned long to unsigned long long George Marsaglia C Programming 1 07-08-2003 05:16 PM



Advertisments