0

I plan to develop browser multiplayer turn-based game (2-6 players per game). Server part planed to write on Java. I have to choose between websockets and AJAX for exchange data in game process. I'm wondering which is the better choice. I thought to use websockets, because it is not critically to support old browsers for me and latest version of browser supports websockets. But I know about websockets problem with proxies and routers. How do you think these problems affect most users? And what is better way to reduce the impact of these problems: use secured websockets instead usual, run websockets server on another (not 80) port? Or it's better to use AJAX? I know about such libraries as socket.io and sockJS. But it's interested about pure websockets.

2 Answers 2

1

You should go for secure WebSocket. This will work in almost all network enviroments. Mobile. Enterprise. Etc. The exception potentially being so-called Man-in-the-Middle proxies which can unwrap TLS, and then WebSocket will depend on the proxy supporting and allowing it.

Note that with AJAX alone you don't have a push channel. If you want push and go with Comet, that can have it's own issues with proxies also.

Sign up to request clarification or add additional context in comments.

Comments

1

WebSocket is a persistent bidirectional connection. AJAX is just request-response. For a game, websockets make more sense. WSS should go through proxies, routers should not be a problem for either WS or WSS. However, some proxies are not friendly to persistent connections and could cut it after a while, there is no workaround for that.

3 Comments

Is this possible to figure out that proxy cut connection from client side?
If you are in control of the proxy, probably you can update to a websocket aware version. It depends on the proxy software.
Not all the proxies cut websockets. There is nothing you can do from the client but try another port if it is a transparent proxy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.