最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Looking for simple way of communication between JavaScript and Java - Stack Overflow

programmeradmin0浏览0评论

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 badges
Add a ment  | 

3 Answers 3

Reset to default 3

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

发布评论

评论列表(0)

  1. 暂无评论