如何在ASP.NET Web应用程序中的服务器和客户端之间进行通信? [英] How can I communicate between a server and client in a ASP.NET webapp?

查看:53
本文介绍了如何在ASP.NET Web应用程序中的服务器和客户端之间进行通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作像webapp这样的字典.

I want to make a pictionary like webapp.

我选择使用.net平台进行开发,并决定使用asp.net服务器创建一个出色的客户端,但是我不知道如何在它们之间进行通信.

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.

我看了一下gRPC,但不知道这是否是用于这种通信的正确工具,假设每秒的滴答度为20到50次.

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.

推荐答案

您可以创建一个Blazor WebAssembly应用程序,该应用程序在浏览器上运行,其默认传输方式为HTTP.但是,您可以根据需要使用SignalR Client.这是要走的路.在文档中查找使用SignalR Client在Blazor WebAssembly中创建聊天应用程序的示例.社区还创建了代码示例,演示了如何创建高级聊天应用程序和游戏,以及涉及到的所有内容.

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.

祝你好运...

这篇关于如何在ASP.NET Web应用程序中的服务器和客户端之间进行通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆