H
H
hound4062015-04-06 12:33:10
Python
hound406, 2015-04-06 12:33:10

Push server, C server link?

Good afternoon.
There is a need to implement a certain service.
We have some devices that periodically send their data to a specific TCP port, which is listened on by a web server written in C, it parses the packets from these devices (device ID, connection time) and passes them to a service that is written in Python. The Python service parses messages from the sish server and "publish" to the redis database by the device ID number (this is necessary to implement push notifications based on tornado + redis. Something like this: habrahabr.ru/post/128562/).
There is a client part, which, when connected to web sockets, "subscribes" to the redis database, i.e. the client has entered the site, he has access to a device with an identifier of 12345 (as from the article from Habr, work with web sockets is implemented). Then the device with this identifier connected to the sish server, which, in turn, processed this message and passed to the python service that the device with this identifier is currently online, this service made an entry in the redis database, which was intercepted by the tornado service))
phew .. .looks rather confusing, it seems ... but with such a scheme, everything seems to work as it should.
But here everything works in one direction, that is, the device connected - it transmitted information to the client, but what if the client wants to send something to this device? How, with such a scheme, can the service be forced to send an unscheduled message to the connected device?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
Yuri Shikanov, 2015-04-06
@dizballanze

Well, in the opposite direction, it’s simple, the client sends data via web sockets, the server publishes in Redis, and Tornado (or even the C application itself) listens to this channel in Redis and sends a message to the device.

H
hound406, 2015-04-06
@hound406

It will probably be more preferable here that redis listens to the sish application, and another to the tornado ...
Then we have +1 service and, accordingly, the sish application should keep a connection with another Python service. Or is there an easier way to do this?

S
Sergey, 2015-04-06
@begemot_sun

It's a trivial task to implement this in Erlang.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question