Skip to content

[backend][bugfix] Only communicate with client that requested simulation

Timo Koch requested to merge fix/client-specific-simulations-runs into master

There is two versions of emit: (1) a context-aware version imported from flask_socketio (2) a context-ignorant version socketio.emit

The (1) version automatically only communicates with the client that send the request. The (2) version is used in context-ignorant setting, e.g. a long-running background task like the Docker result streamer. However, the default will emit the message to all connected clients. So all clients get results from all currently running simulations.

With this fix, we now pass the client/socket id to the stream which then only emits the result messages in the private "room" of the client that requested the simulation. In all other occassions in the backend, we use the context-aware version of emit now. Tested in local setup with two tabs in the same browser. Before this commit I would get messages from both running simulations. After this commit I only get the results of the simulation I started from that respective tab.

Merge request reports