How can I communicate between a server and client in a ASP.NET webapp?

≯℡__Kan透↙ 提交于 2021-01-28 21:08:40

问题


I want to make a pictionary like webapp.

I chose to develop using the .net platform, and decided to make a blazor client with a asp.net server, but I don't know how to communicate between them.

When a player is drawing something, as he/she draws, whatever he/she is drawing should appear on the other player's client, but I don't know how should to send this data to the server and back to the other clients.

I took a look at gRPC but don't know if this is the right tool for this kind of communication assuming a tickrate of 20 to 50 times a second.


回答1:


You may create a Blazor WebAssembly App, which is running on the browser, and whose default means of transport is HTTP. However, you can use SignalR Client for your requirements. This is the way to go. Look up in the docs for the sample of creating a chat app in Blazor WebAssembly employing SignalR Client. There are also code samples created by the community demonstrating how to create advanced chat applications and games, and every thing involving that.

Good luck...



来源:https://stackoverflow.com/questions/61642412/how-can-i-communicate-between-a-server-and-client-in-a-asp-net-webapp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!