Intro: I want to develop simple multiplayer Five in row (Gomoku). Front-end should be done using JavaScript, and back-end in Java.
Basically client and server should exchange pairs of integer numbers and game id. It's easy to do on client side with WebSockets, but...
Question: Is there simple way to process munication on server side, using Sockets and ServerSocket, without embedding Jetty or any other server?
Intro: I want to develop simple multiplayer Five in row (Gomoku). Front-end should be done using JavaScript, and back-end in Java.
Basically client and server should exchange pairs of integer numbers and game id. It's easy to do on client side with WebSockets, but...
Question: Is there simple way to process munication on server side, using Sockets and ServerSocket, without embedding Jetty or any other server?
Share Improve this question edited Feb 14, 2012 at 19:46 Peter Svensson 6,1731 gold badge34 silver badges31 bronze badges asked Feb 8, 2012 at 9:00 VillerViller 5305 silver badges19 bronze badges3 Answers
Reset to default 3Since Front-end is javascript it might run in a web browser. To municate with the server most likely using http, then embedding Jetty and using dwr is the simplest way IMO.
If you intend to do such thing on a web project, have a look at the DWR project.
WebSockets browser support is poor at the moment.
If you're creating a Web application the mainstream solution for JS-Java munication is Ajax with some JS framework like jQuery or Dojo. It will not require any libs on the server side (unlike DWR) and also you don't need to put any JS stuff on your server if you use CDN.