New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server Side Blazor First Client Receiving Second Client's Requests #1726

Closed
cyberjaws opened this Issue Nov 26, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@cyberjaws

cyberjaws commented Nov 26, 2018

Server Side Blazor:
Create a data service that connects to RabbitMQ and register the data service as a singleton.
Connect a client and register for a callback event from the data service.
Make a request to the data service. Request gets sent over MQ. Method returns.
...wait for x ms...
Response come back over RabbitMQ and fires an event in the data service.
Event fires in client 1, check the results against a clientId created at startup, fire a JSInterop method on the client to update an image if the clientId matches the Id in the result.
With one client connected, the image comes through no problems.
With a second client connected the image gets returned to the first client and the correct clientId / image combo doesn't make it to the second client.
Thoughts?

@SteveSandersonMS

This comment has been minimized.

Member

SteveSandersonMS commented Nov 26, 2018

fire a JSInterop method on the client

My guess is that you're using JSRuntime.Current. Don't, because that always refers to the current user's request. Do the following instead in your component:

@inject IJSRuntime jsRuntime;

... and then use jsRuntime to issue the JS interop call instead. That way you'll be sending the info to each client separately.

@ransagy

This comment has been minimized.

ransagy commented Nov 26, 2018

Maybe this is something to note in the documentation on the various changes between Client and Server sided Blazor, perhaps even in the templates.

@cyberjaws

This comment has been minimized.

cyberjaws commented Nov 26, 2018

Thanks for the quick response. I will make the change shortly and see if that addresses the issue. Very excited about this project, keep up the great work!

@cyberjaws

This comment has been minimized.

cyberjaws commented Nov 26, 2018

That was it! Brilliant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment