Dash-extensions only work with clientside callbacks?

In order to have websockets support is it worth to use the dash-extensions websocket? I think that it does not provide direct access of the message to dash components. It works with clientside-callbacks. Which it means writing javascript etc…

Hello @predentusl,

Welcome to the community!

I dont think that you are limited to using only a clientside_callback with the websocket. The benefit of the clientside_callback is the speed at which the webpage can render the changes as well as a smaller number of network calls.

If you want the websocket to trigger a network transmission then I am sure you can do this.

Why are you trying to do this? There might be a better way to accomplish what you are doing.

@Emil, do you have any thoughts on this?

You can use the websocket to invoke normal callbacks - no problem. But typically, it would be more performant to use clientside callbacks to do the update :blush:

1 Like

I want to add real-time functionality to my app. I want the users to participate concurrently in some aspects of the app i.e. participate in quizzes concurrently and I want the layout of the quiz to be dynamically created and in real time getting the user responses. I tried to use the websocket message in a standard callback as string (simple or json-type) but no luck…It returned NoneType object at the client although the server send the message as type string. It works with cliebtside callbacks. If you have a working example that you can share I will be vary happy to understand the logic.

There is a small example in the docs utilizing normal callbacks,

@Emil
This is the magic point in your code. return f"Response from websocket: {e[‘data’]}" - apparently we should use [‘data’] as a key for the message string. I am saying that because I used other variables and never worked. I shall try it tomorrow because today I “lost” at least 5 hours in such a small detail…You use data as a key in your first example, too. Is it a standard for the quart server?