Viller
Viller

Reputation: 540

Looking for simple way of communication between JavaScript and Java

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 communication on server side, using Sockets and ServerSocket, without embedding Jetty or any other server?

Upvotes: 0

Views: 5778

Answers (3)

user1196351
user1196351

Reputation: 31

Since Front-end is javascript it might run in a web browser. To communicate with the server most likely using http, then embedding Jetty and using dwr is the simplest way IMO.

Upvotes: 3

Oleg Mikheev
Oleg Mikheev

Reputation: 17444

WebSockets browser support is poor at the moment.

If you're creating a Web application the mainstream solution for JS-Java communication 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.

Upvotes: 0

George
George

Reputation: 4109

If you intend to do such thing on a web project, have a look at the DWR project.

Upvotes: 2

Related Questions