Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在做聊天项目。我每 2 秒向服务器发送一个 AJAX 请求以接收新数据,但在大多数情况下,服务器上不存在任何新数据。 我想在新数据可用时响应新数据。换句话说,我不想每 2 秒重复一次请求。 当有新数据可用时,我如何响应客户?
我不确定到目前为止你已经实现了什么,但你可能想看看 Asp.net SignalR是 asp.net 系列的新成员。我认为它更适合您想要实现的目标。