-
-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Disconnected
event gets incorrect values
#103
Comments
I'm not sure what exactly is the problem you're mentioning. It definitely does return codes 4000+ as we use it to determine Auth failure Can you make a small sample code replicating the issue? |
I got error 1001, as in the screenshot, using the original TestClient project. If the error was in the range of 4000-4012, then it would be displayed in text, not numbers.. Steps to reproduce the behavior:
|
1000 is not a OBS Close Code so it won't return an enum value. The other codes are internal Websocket codes |
Yes, I understood that. It's just not documented. At the moment I have to do something like this? if ((int)e.ObsCloseCode < 4000)
{
var ee = (System.Net.WebSockets.WebSocketCloseStatus)e.ObsCloseCode;
switch (ee)
{
case System.Net.WebSockets.WebSocketCloseStatus.NormalClosure:
break;
case System.Net.WebSockets.WebSocketCloseStatus.EndpointUnavailable:
break;
case System.Net.WebSockets.WebSocketCloseStatus.ProtocolError:
break;
case System.Net.WebSockets.WebSocketCloseStatus.InvalidMessageType:
break;
case System.Net.WebSockets.WebSocketCloseStatus.Empty:
break;
case System.Net.WebSockets.WebSocketCloseStatus.InvalidPayloadData:
break;
case System.Net.WebSockets.WebSocketCloseStatus.PolicyViolation:
break;
case System.Net.WebSockets.WebSocketCloseStatus.MessageTooBig:
break;
case System.Net.WebSockets.WebSocketCloseStatus.MandatoryExtension:
break;
case System.Net.WebSockets.WebSocketCloseStatus.InternalServerError:
break;
}
}
else
{
switch (e.ObsCloseCode)
{
case ObsCloseCodes.DontClose:
break;
case ObsCloseCodes.UnknownReason:
break;
case ObsCloseCodes.MessageDecodeError:
break;
case ObsCloseCodes.MissingDataField:
break;
case ObsCloseCodes.InvalidDataFieldType:
break;
case ObsCloseCodes.InvalidDataFieldValue:
break;
case ObsCloseCodes.UnknownOpCode:
break;
case ObsCloseCodes.NotIdentified:
break;
case ObsCloseCodes.AlreadyIdentified:
break;
case ObsCloseCodes.AuthenticationFailed:
break;
case ObsCloseCodes.UnsupportedRpcVersion:
break;
case ObsCloseCodes.SessionInvalidated:
break;
case ObsCloseCodes.UnsupportedFeature:
break;
}
} If the answer is yes, then I think you can close this question. |
I too am seeing 1000, 1001 etc coming in this handler from In my case, connect to OBS, then force close OBS -> 1001. You asked for a reproduction:
Running this, with OBS open, waiting till you see connected and then closing OBS will result in a 1001 close code. I think the original poster is saying that the additional codes(<4000) are not documented in the library and that the type( I guess that when I consume a client application, I expect an Enum value to not contain values that are not defined in the Enum. If I were writing this library I would probably either:
In my case, I can handle this with some extra code similar to the original poster, but I do agree with them it is confusing. |
I will address this moving forward |
Issue Type
Describe the bug
The
Disconnected
event returns only values fromWebSocketCloseStatus
(1000-1011) and marks them asObsCloseCodes
. Whereas the OBS protocol returns the values 0, 4000, 4002, 4003-4012.To Reproduce
Steps to reproduce the behavior:
OBSWebsocket.OnWebsocketDisconnect()
d.CloseStatus
Expected behavior
Probably I would like to get either a combined enum from the OBS protocol and the WebSocket enum, or get some kind of remap of WebSocket values to the values from the OBS protocol enum.
Screenshots
Versions
OBS Version: 28.0.1
OBS WebSocket Version:
OBS WebSocket Dotnet (this library) Version: 257e7b4
OS: Windows 11
The text was updated successfully, but these errors were encountered: