Mature WebSocket / Socket.io server side implementations? - node.js

I have closed-source server-side software that communicates with proprietary messages over TCP.
I would like to program a client for this server that runs in the Safari web browser (an iPad).
I believe the best way to do this is to create a middleware program that translates between the WebSocket or Socket.io protocol and the proprietary format used by the server.
I'd be most comfortable writing the midleware in C/C++ or Java, but other languages readily usable on linux would also work. The connection to the server can not be closed between calls and we need to maintain state, so languages like php are probably not appropriate.
I've looked at a half-dozen server side Socket.io implementations, but nothing stood out as being ready for prime-time.
What are some mature sever-side platforms / libraries for a browser socket implementation out there? The things that are most important to me are:
Stability... It should run for months without being restarted
Maintenance and Community... No dead projects
While it seems like nothing is truly mature in this area, any hints as to the best possible paths for a production system would be appreciated.

It is difficult to grasp what you really want to know from us.
I've looked at a half-dozen server side Socket.io implementations, but
nothing stood out as being ready for prime-time.
I believe http://socket.io/ for node.js is pretty stable, used by many, has a huge community, and is by far not dead.

Related

How to integrate Node.js Server in My cocod2d-x (C++) Game

I am new in Multiplayer Game Development, I have already developed a offline game and now I want to make it a multiplayer, so with help of my friend we create a server side script in node.js, but I don't know how to integrate this in my c++ project,
I've googled but, can't find anything helpful.
anybody can suggest any tutorial.
Thanks
You've asked a big open-ended question. As Allern suggests there are a lot of things that you can do with networked programs that can extend it well beyond that of a single user game. For instance in my current game there is an access to a version welcome page in html. There are file downloads for campaign/user maps and there are connections to Firebase for leaderboards and other networked resources like ads.
However, I suspect you are referring to the communications between a number of separate user machines all synchronized to keep them coordinated. For this you will need to write some serialization code to transmit to and receive packets from the central server. Typically a serialization package like flatbuffers will be needed to move information from your data structures to a packet and the reverse.
You might also require communication/network software to asynchronously send and receive those packets (this may be included in whatever game engine you might be using). Boost.asio might help otherwise. There are numerous other networking packages and libraries all the way down to the bare-bones unix/POSIX calls (or Windows OS calls).
You will also need software on the server side to log users in, deal with players disconnecting and doing the main work of passing the game packets around. This software may also implement the logic of your game (game rules) and might do saves on the data if you want users to be able to play the game in multiple sessions (like a big dungeon crawl). There might be packages out there that do most of the server side stuff. If so, please post what you find out.
Cocos2dx does have some networking software built in but it isn't very functional as far as I'm concerned. It does have facilities to display web pages and download files fairly easy but the async communication seems a little weak. You can try the Network module in the API Docs which may have what you are looking for.
Since the type of game and how you want to implement your player interaction will dictate how the software is to be built I'm afraid this answer is a little vague. Good luck. Share your insights.
you can use public tools , as a sample is websocket,it can support C++ and javasc

Why all those new languages have their own web server?

I am kinda old school and the first programming language for web I saw was PHP, and everybody uses it with Apache. At that time, I also knew ASP, which were used along with Microsoft IIS and, later, ASP.NET, that runs over IIS, as well.
The time passed, I went to the ERP world and, when I came back (few months ago), I knew Golang and Node.js and for my surprise they have their own web servers.
I can see many advantages in the builtin web servers, but, every application needs to rewrite their web server rules (I faced that recently when I needed to setup a HTTPS server using Express.js).
After some hard work to understand all the nuances of the HTTP protocol, I asked myself: and if I am doing it in the wrong way? If all the permissive rules that I created in my dev server go to production? Maybe this is an useless concern. But maybe I am creating a fragile server that could be exploited by a naive hacker.
Using a server like Apache it is harder to misuse security rules, because there are settings for development and production environments that are explicit. If the rules are hardcoded (as they are in Node or Go), an unaware developer can use development rules in production and nobody is going to see it before the stuff happens.
Any thoughts?
web server focuses on the speed capacity and the caculating capacity. No matter how good java or php web is or how many old companies put them in use, as long as a new language can provides a faster speed and better capacity such as go, more programmer would go for it.
by the way, to run a web server in go is really such an easy thing.It's faster building and slightly running.And the routine in go helps the web server beter serves milions of client requests,Which old web language can hardly do it.
You can still use nginx or apache in front of your golang gateway for many reasons including tls termination.
But service to service communication might be nice to communicate directly to services and the golang http webserver is fast. It also supports http2 out of the box. Go leverages its "goroutines" to reduce overhead from the os to handle many requests at once.
Node.js and Golang do not have their web server, these are just some lib packages implement http-protocols and open some ports to provide services.
Like Spring web.
Nginx/IIS/Apache are true server, web server just a component of them.
I think Spring should meet the full application scenarios, include /gateway/security/route/package/runtime manage/ and so on.
But when we has some different language platform, then we need nginx/apache/spring gateway/zuul/or others to route them.

What's better for Video and Real-Time Control - ZMQ or Websockets?

I am writing a remote server to control a robot with. The robot provides video and its current sensor state; the server sends control commands.
My choices for sending the frames and the control/sensor-state between the robot and the server ( 2-way ) are ZeroMQ and WebSockets.
I need:
Speed
Security
My coding partner wants to use Websockets because it's undergoing standardization, but I have 3 months of experience using ZMQ to do just what we're trying to do, so I'm fairly certain the choice doesn't matter.
However, I'd like to know if anyone can think of a compelling reason to go with one OR the other (XOR). We're not going to use ZMQ+Websockets because we don't need to.
Looking at what WebSockets are, I honestly don't think it's going to make much difference. They're simply a way to switch between speaking HTTP to the WebSocket framed message protocol down the same TCP connection. ZMQ gives you framed messages too, but you'd be using that over a network connection separate from the web browser's HTTP connection.
Latency comparisons are going to depend on just how good a run time environment the Web Browser provides. It seems to me that use of WebSockets will involve writing the client side code in Javascript and running that in the browser (the "modern" way), so that code will be at the mercy of the Web browser's Javascript engine (they're pretty good I think).
With ZMQ you may be having to write a native application for the client end (I don't know if it can be used within a web browser within Javascript - I need some education!). A native application is free of any influence from a web browser, so it might be just a shade better.
But if your real time requirement is only on the human scale (i.e. it need respond only quick enough to make a human happy), I think either will likely be sufficient. Neither can overcome propagation times across the Internet, neither can account for OS / browser delays.
The one difference is that with WebSockets it looks like you have to switch between HTTP and WebSocket protocol. So if you need to switch back to HTTP to load some web element or other, that's going to interrupt the flow of WebSocket data until you switch back again. Whether or not that is actually a problem is going to depend very much on what your client side application is doing (for example, you may very well be talking to a separate web server for web page elements, in which case you'd have two connections on the go anyway).
With ZMQ you're going to have a dedicated connection.

Connecting Node.js and openFrameworks

What is the best way to connecting Node.js code and openFrameworks(oF) code?
I though zmq would be nice, because it seemed easy to use (has many wrappers), and light and fast. ofxZmq, the zmq addon for openFrameworks, however, just didn't work well. It crashes when receiving messages.
I want something as easy to use as possible.
I have done a simple communication from an open frameworks client to a node.js server via OSC protocol. It is very popular in the OF world, and it can be read by a bunch of similar software and frameworks (processing.org, PureData, VVVV, Max/MSP, etc)
Here you have some different chooses for OSC implementation via UDP:
https://nodejsmodules.org/tags/osc
Check out ofxNodejs, it comes with a couple of examples to get you started.
In general, most "connecting X to openFrameworks" questions can be answered by checking out ofxAddons.com, which keeps a list of openFrameworks addons accessible by github (updated daily).

Open Aource application/protocol for internet applications

In near future I'll need to start working on a new project that consist of highly loaded TCP/IP servers and clients that communicate to that server. I know the basics of TCP/IP and can make the server and clients talk over the wire.
The problem is that I need to find some ways to protect server against other "clients" that can send bogus data and may crash the server. I'm looking for any ideas or recommendations for an application-level protocol that I can use for my application. Pretty sure there must be some kind of open-source MMORPG game that has already implemented such a protocol.
Any other ideas are very welcome.
P.S. I have checked already the WorldForge project.
Use authentication and write your server so that bogus data doesn't crash it. You can also utilize firewalls where appropriate.
Have a look at http://www.devmaster.net/ for game development. I've read many useful articles there.

Resources