MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / Abort

Method Abort

sdks/csharp/src/WebSocket.cs:432–455  ·  view source on GitHub ↗

Forcefully abort the WebSocket connection. This terminates any in-flight connect/receive/send and ensures the server-side socket is torn down promptly. Prefer Close() for graceful shutdowns.

()

Source from the content-addressed store, hash-verified

430 /// and ensures the server-side socket is torn down promptly. Prefer Close() for graceful shutdowns.
431 /// </summary>
432 public void Abort()
433 {
434#if UNITY_WEBGL && !UNITY_EDITOR
435 if (_webglSocketId >= 0)
436 {
437 WebSocket_Close(_webglSocketId, (int)WebSocketCloseStatus.NormalClosure, "Aborting connection.");
438 _isConnected = false;
439 }
440 else if (_isConnecting)
441 {
442 // No socket yet; ensure we close immediately once it opens.
443 _cancelConnectRequested = true;
444 }
445#else
446 try
447 {
448 Ws?.Abort();
449 }
450 catch
451 {
452 // Intentionally swallow; Abort is best-effort.
453 }
454#endif
455 }
456
457 private Task? senderTask;
458 private readonly ConcurrentQueue<ClientMessage> messageSendQueue = new();

Callers 1

DisconnectMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected