I’m following the instruction by Microsoft but I can’t use BackgroundSocketProcessor
. Do I miss any library?
This is my Program.cs
:
app.Run(async (context) =>
{
using var webSocket = await context.WebSockets.AcceptWebSocketAsync();
var socketFinishedTcs = new TaskCompletionSource<object>();
BackgroundSocketProcessor.AddSocket(webSocket, socketFinishedTcs);
await socketFinishedTcs.Task;
});
I’m really confused and trying to figure out why it doesn’t work
nhất lê hồng is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
It is because in the current context, ‘BackgroundSocketProcessor’ has not been defined or declared, the system cannot find a corresponding definition.
So, you could create a class named BackgroundSocketProcessor
to define it. Refer to the sample code provided by Microsoft.
internal class BackgroundSocketProcessor
{
internal static void AddSocket(WebSocket webSocket, TaskCompletionSource<object> socketFinishedTcs) { }
}