How requesting state works

SignalR does not provide a typical IPC communication between the client and server. It sends messages in one direction and does not wait for a response. When you need a response from the client, for example, we Get-UDElement, you need to use the StateRequestService to accomplish this.

This is how it works.

When you call Get-UDElement, it calls from the server down to the client via the requestState SignalR message. It creates a unique ID for this request.

Then it starts waiting for the StateRequestService to have a result for that request.

On the client side, the web socket receives the requestState message and sends a message to the registered component with the component ID that was provided.

The component then processes the requestState message and posts up to the sessionState endpoint.

This endpoint then sets the sessionState into the SessionStateService. This causes Get-UDElement to find the value and then return it to the user.


@AlonGvili - For Get-UDLocalStorage, you should use the SessionStateService.

Make Get-UDLocalStorage work like Get-UDElement. In the ud-dashboard.jsx, publish the result of the request to the sessionState endpoint with the value of the local storage element you are trying to call.

1 Like

Thanks will yry it and post the result