Cysharp / MagicOnion

Unified Realtime/API framework for .NET platform and Unity.
MIT License
3.68k stars 417 forks source link

Question: Is there a way to force the server to disconnect the client's connection when using the streaminghub? #766

Closed yiwhdduq closed 1 month ago

yiwhdduq commented 2 months ago

Hello. First of all, thank you for creating a great framework. I'm a newbie at English, C#, ASP.NET, and gRPC. I'm familiar with Node.js, HTTP, and WebSockets. I spent over a week searching and struggling fruitlessly, but I still don't understand.

Here are some questions about the streaming hub:

  1. If there is a completely wrong connection attempt or if the same user tries to connect multiple times, I want to forcibly terminate the previous ConnectionID(ContextID) or the current ConnectionID(ContextID) of the user.

  2. Before server maintenance, I'm curious about how to close all connections for all users from the server at once after notifying all clients of the maintenance schedule.

// In a WebSocket or TCP server
// allWebSockets is a dictionary containing all sockets or websockets
for(var ws of allWebSockets)
{
       ws.close(); // I'm curious about a similar approach.
}
  1. When replacing the serializer with memorypack, serialization errors occur when calling the service using Swagger. Does this mean Swagger cannot be used when memorypack is used?

Thank you in advance for your response.