I'm looking for a communication model that is constructed the following way:
One or more clients can connect to a server
One (chess-)engine connects to the server
The information flow is only one way, e.g if any client sends a message to the server, the server will forward the message to the engine. But if the engine responds, it should first send the respond to the server which forwards the response to the specific client.
Additionally, do you have any ideas or code examples on how to program that using c++ with boost/beast?
Related
I've developed a WebApp with Flask, where different threads check a status and, if something changes they send a new json to the client. Then the client, with the javascript, can update the html page.
Running the app in my LAN, different clients connect and everything work correctly.
If I run the app on a real server (such as AWS, by using "flask run --host=0.0.0.0" ), the clients can connect and show the web page, but they don't receive the json sent by the socket of the webapp.
In the WebApp, a thread sends the new json by calling a function that uses:
socketio.emit('update', {'number': new_json_FE}, namespace='/test')
While the javascript receives this message (and does something) in this way:
socket.on('update', function(msg) { ....}
It is very strange that the clients connected in the LAN receive correctly all the json sent by the socket, while in the web not: they only receive the json when they connect to, and I have to upload the page (they don't receive the socket messages).
Can you help me?
Thank you very much!
I would advise against the use of threads like you have described for this situation.
Instead I would probably create a new program, StatusUpdater, that is always running and which is connected via socket to your Flask-SocketIO backend. When it finds a change in status it sends w/e signal or payload it needs to, through a socket, to the Flask-Socketio server. The SocketIO server upon receipt of this StatusUpdater payload can then send a broadcast to all connected clients notifying the client of the update.
I would like to test my web service listener class. The listener class can able to send and receive soap request and response respectively using C++11 and cURL. But My listener needs to receive push messages as well which I am not sure whether my listener able to do it or not. I have WSDL (2)files of the actual web service. Where in I have a message formats for responses.
Basically I want to configure SOAP UI which accepts connection request, if it is connected it should start pushing messages to the connected client. Is there any possibility to implement such scenario in SOAP UI? {if there is any other ways to the implement the same also welcome}
Once I have connected with the web service the connection will left open. Whenever the service have new message, it will simply send the message to the client with out the need of any request from client. I hope now it is clear.
I'm writing a Clojure application that uses websockets to communicate with clients. The server sometimes acts as a sort of hub, getting a message from one client and that triggering sending a message to another client. If I have only one web server that's fine, but if I have two I run into trouble as clients might be connected to different servers.
I think the best way to deal with this would be for a web server to broadcast the message received to the other ones so all of them can react and notify the appropriate client. How can I do this? Any libraries that can help?
If it matters, I'm planning on hosting this in Heroku at first but I always want to leave the door open for self hosting.
I have a client server based c++ application which communicates over network (with boost asio) and I am planning to distribute this client application to my customers. My problem is I don't know how to prevent connection request from other applications, that is how can I make sure that only my client application is able to connect to my server. I think there is no way to do this without making the connection, than what is the best way to verify that request is coming from my client?
You can use asio's builtin SSL ability. So, you generating sertificates for each server, and client sertificates. So you can check client sertificate on server at the moment of SSL handshake. As a bonus, your traffic will be encrypted and SSL-secure. Clients can check server is not a fake; server can check clients are authorized.
Yes you have to accept the connection in order to know if it's from your application or not.
You can use a three-way handshake at the connection step:
Client connects to the server The server is sending an specific
value (integer, strings or whatever) to the new client.
The client handles this value, compute a new one with it and sends
the new value to the server.
The server checks if the returned value is correct or not.
The client will have the same compute method as the server. The others applications will not be able to use your service if they returned a bad value.
I have a web server that listens for jQuery keyboard events and I would like to send a string of the status for a set of keys to another domain for processing.
What technology/language/protocol is able to do this on the server-side?
It must be able to send the updated status message upon immediate change as listened for by keyboard events like arrow keys.
This is not a standard server <-> client updating but rather client > server > another server.
Can a WebSocket be used to create a server-side connection to a remote location, not a client?
https://en.wikipedia.org/wiki/WebSockets
What technology/language/protocol is able to do this on the server-side?
Any modern server side language can do it, node.js, c#, python, php. Just write your condition and make the request from your server as client.
Can a WebSocket be used to create a server-side connection to a remote location, not a client?
Of course! Your server can be a client like any other device. NodeJS example