lrav
lrav

Reputation: 43

Javascript client C++ server game

I have a question which path should I follow.

I want to develop real time online game via webbrowsers.

I would want to write game server using C++ with TCP sockets listening. The client side game will be written in javascript. The only problem I dont know how to communicate javascript with c++ server using TCP sockets. I have considered using Socket.IO but as far as I know this library does not have option to just connect to real TCP server, push bytes through and read incoming ones. Instead I would need to use some wrapper like Node.JS server which I want to avoid.

Anyone could guide me which path I should take?

Upvotes: 3

Views: 2510

Answers (2)

icktoofay
icktoofay

Reputation: 129011

You could make your game server itself an HTTP server. For the most part it could just serve up your static files, but when it received a WebSocket upgrade request, it could handle that however it desired.

Upvotes: 1

Quine
Quine

Reputation: 158

You should take a look to websockify:

websockyfy is a WebSocket to TCP proxy/bridge. This allows a browser to connect to any application/server/service. Implementations in Python, C, Node.js and Ruby.

Upvotes: 0

Related Questions