The Code Analysis warning is because you are using an object initializer on a disposable object.
Whenever you use an object initializer a temporary, invisible local is created (see this question for more details). It is this object (<>g__initLocal0
) that the message is referring to, as you are not able to dispose of it if an exception is thrown while it is being created.
If you set the properties separately
_webSocketServer = new WebSocketServer(port, IPAddress.Any);
_webSocketServer.OnReceive = OnReceive;
then the message will go away, as no temporary object is created.