Show / Hide Table of Contents

# Class WebSocketClosedException

The exception that is thrown when the WebSocket session is closed by Discord.

##### Inheritance

System.Object
System.Exception
WebSocketClosedException

##### Implements

System.Runtime.Serialization.ISerializable
System.Runtime.InteropServices._Exception

##### Inherited Members

System.Exception.GetBaseException()
System.Exception.ToString()
System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)
System.Exception.GetType()
System.Exception.Message
System.Exception.Data
System.Exception.InnerException
System.Exception.TargetSite
System.Exception.StackTrace
System.Exception.HelpLink
System.Exception.Source
System.Exception.HResult
System.Exception.SerializeObjectState
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.MemberwiseClone()

###### Namespace: Discord.Net

###### Assembly: Discord.Net.Core.dll

##### Syntax

    public class WebSocketClosedException : Exception, ISerializable, _Exception

### Constructors

| Improve this Doc View Source

#### WebSocketClosedException(Int32, String)

Initializes a new instance of the WebSocketClosedException using a Discord close code and an optional reason.

##### Declaration

    public WebSocketClosedException(int closeCode, string reason = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32 | closeCode |
System.String | reason |

### Properties

| Improve this Doc View Source

#### CloseCode

Gets the close code sent by Discord.

##### Declaration

    public int CloseCode { get; }

##### Property Value

Type | Description
--- | ---
System.Int32 | A close code from Discord.

| Improve this Doc View Source

#### Reason

Gets the reason of the interruption.

##### Declaration

    public string Reason { get; }

##### Property Value

Type | Description
--- | ---
System.String |

### Implements

System.Runtime.Serialization.ISerializable
System.Runtime.InteropServices._Exception