H
H
HaruAtari2015-09-06 10:30:03
Python
HaruAtari, 2015-09-06 10:30:03

In what language is it more convenient to write a websocket server?

Good afternoon.
There is a task to make a web-application (on a site). In general, something like a ticket system on steroids with a number of features. The application is being written for itself and its development team, so there are no plans for a particularly heavy load.
Everything is under the MIT license, so that if someone meets the same requirements for the development process as ours, they can take it and run it at home, pre-finishing it if necessary.
Client-server communication via web sockets. Standard rest is not suitable. Most of all actions occur at the initiative of the server. At the moment, only a web muzzle is planned, but in the future we need the ability to tie a mobile application to this api.
I don't think you need a fullstack framework like django, ror. It will be enough to collect several libs so as not to overload the application: orm, routing, cache. In the case of scala / erlang, the latter can be completely abandoned, and the language itself can keep the data in memory. Although if there is something lightweight, suitable for the requirements, then you can use it.
The database is relational.
I myself specialize in php and know about other languages ​​only in theory. But development experience allows you to sit down with a new language and start writing.
For the frontend, I chose angular - two-way binding is a very similar thing, as for me.
But with server language I doubt a little. You can write a daemon in php, but I'd rather take a language in which long-lived processes are part of its model.
At the moment I see the following options:
1. scala + akka. The actor model is well suited to the task. Plus JVM allows you to run the server on any axis.
2.python.
3. You can stubbornly and do it in Erlang. Actors. Virtual machine. The absence of heavy calculations allows you not to be afraid of performance drops.
4 Go. I heard it out of my ear. At a cursory glance, I liked the convenient multithreading. But what about the ecosystem, I don't know.
Nodejs is suitable, but refused immediately because I can't stand js. And if this is a necessary evil on the client (I know about typescript, coffescript, etc.), then on the server you can avoid eating cacti.
Rust also has an actor model, but, in my opinion, it is too complicated for this task.
An important point: since this is a personal project that I myself do to facilitate my work and the work of my team, I do not care about the ease of finding developers in the chosen language. At the same time, the ease of launching an already assembled application is important for me.
I was developing rest servers, but I didn’t work with real-time systems, and therefore I may not fully know all the pitfalls. Who has experience in developing such systems, advise which language will be more convenient and faster for server development?
UPD: Thank you all for participating!
I decided to write in PHP, and put a centrifuge in front of it for sockets. Because:
1. PHP is very common. Because the code will be open, I don’t want to create problems for others when finishing it for myself. The more common the language, the easier it will be for others to use the app.
2. Because The image to the application remains according to the standard rest scheme, you do not have to write the API separately. Centrifuge can access the application's standard API, which other applications can also bind to.

Answer the question

In order to leave comments, you need to log in

8 answer(s)
I
index0h, 2015-09-06
@HaruAtari

Generally speaking, it's faster / more convenient on nodejs.
If your goal is to get the project you want quickly - write business logic in PHP, use habrahabr.ru/company/mailru/blog/266017/ for websockets .
Can I have a link to your project?

D
Dmitry Avilov, 2015-09-06
@TheCreator

Nodejs is suitable, but refused immediately because I can't stand js.

And you will learn how to cook it correctly, it is very tasty, just for a "reactive" web application, asynchrony (which you probably don't like) makes it possible to work super-fast.

A
Andy, 2015-09-10
@mag2000

Since I heard to stubbornly ... :-)
In other words, since there is free time, why waste it in the void. Let's look at the other side: PHP is shit, but JS is ok. Norm? :-)
But you don't have to worry about your system. Maximalism? Give you caches, Go, Scala?
Your application is an event machine trying to talk to a person through a browser :-)
n2o - just read the readme and you will understand everything yourself. And no JS frameworks that try to data, you will write SPA and send DOM via WS from the server as you wanted, at any time, from one microprocessor of the serving user.
And just like the JVM - on any wheelbarrow, moreover: compilation on the fly with a hot update without losing connections. noSQL out of the box, and even distributed. Executing code on another machine via TCP...
Yes, most of the features are simply redundant for you, but they are there, out of the blue. Are you talking about the ecosystem? Here she is.
You will give your colleagues a play in the form of a Unikernel bundle , which itself can also recompile itself.
It remains to learn Erlang on this project in 10 days and that's it. It is 10 times clearer than PHP. Enjoy))

S
Super User, 2015-09-06
@sergeystepanov1988

Nodejs is suitable, but refused immediately because I can't stand js.

Bjorn Stroustrup.

R
Renat Ibragimov, 2015-09-10
@MpaK999

Nothing interferes with CoffeeScript under Node.js - so it's better to take what you know - write faster. And the project will take off, rewrite it already on something serious like Erlang, Go, Scala.
But it won’t take off - well, okay, but they didn’t kill a lot of time and didn’t lose the project.

M
Mikhail Potanin, 2015-09-10
@potan

Scala and Play Framework are fine. When web sockets were required, I managed to twist them without difficulty.
True, Scala itself is not the easiest language, it may take some time to figure it out.

V
Viktor, 2015-09-17
@Levhav

If you want to implement as quickly as possible, you can try saas service to work with websocket instead of writing your own service. For example here https://comet-server.ru/
Then the rest can be written in php and the resulting application will have low hosting requirements since work with websocket will not be performed on your servers and will not load your infrastructure.

U
UA3MQJ, 2016-04-15
@UA3MQJ

And Erlang is close to me and I use AngularJS for work. Therefore, n2o was not very interested. We must study. And I already know Angular more or less. Recently, I also wondered about creating a websocket server, and settled on YAWS (the cowboy also supports it, but I didn’t gather on Windows). On Windows, YAWS started up fine. Moreover, I was able to run it as an embedded server in my Erlang application. In fact, everything is the same as in the case of a regular server and angular, only here we establish a connection not with rest but with ws. On the server side, YAWS normally gives pages, and in the case of a transition to WS, it calls a callback written in erlang. Everything is clear and understandable. Figured it out in an hour.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question