UWP MessageWebSocket not working when manually set proxy

0

My UWP MessageWebSocket not working behind the proxy when i set proxy manually its through 403 error; Forbidden (403). (Exception from HRESULT: 0x80190193) When I remove manual proxy then it's able to connect successfully

NEED TO USE ANY OTHER CLASS FOR SOCKET CONNECTION BEHIND PROXY LIKE "StreamSocket" etc ??

HTTPS calls working well only issue with MessageWebSocket

its there anything need to do in code to connect socket connection behind a proxy server?

ObjFactory.Instance.CreateLogger().Log("-------------- SOCKET Connect 6", GetType().Name, false);
                    ObjFactory.Instance.CreateLogger().Log("Connect DisConnected", GetType().Name, false);
                    ConnectionState = SocketConnectionState.Connecting;
                    Messenger.Default.Send(true, MessengerToken.SOCKETCONNECTING);
                    ObjFactory.Instance.CreateLogger().Log("Start Connect PushUrl = " + pushUrl, GetType().Name, false);
                    messageWebSocket = new MessageWebSocket();


                    SocketMessageType currentSetting = messageWebSocket.Control.MessageType;
                    messageWebSocket.Control.MessageType = SocketMessageType.Utf8;
                    messageWebSocket.MessageReceived -= WebSocket_MessageReceived;
                    messageWebSocket.MessageReceived += WebSocket_MessageReceived;
                    messageWebSocket.Closed -= WebSocket_Closed;
                    messageWebSocket.Closed += WebSocket_Closed;

                    try
                    {
                        ObjFactory.Instance.CreateLogger().Log("-------------- SOCKET Connect 7", GetType().Name, false);
                        var URL = string.Concat(WebSocketPrefix, pushUrl);
                        await ConnectToJanus(URL);
                        ObjFactory.Instance.CreateLogger().Log("Start Connect URL = " + URL, GetType().Name, false);
                        ObjFactory.Instance.CreateLogger().Log("-------------- SOCKET Connect 7 A", GetType().Name, false);
                        await SendSubscribeMessageAsync();
                    }
                    catch (Exception ex)
                    {
                        ObjFactory.Instance.CreateLogger().Log("Connect 1 Ex = " + ex.Message, GetType().Name);
                        ObjFactory.Instance.CreateLogger().Log("SendMessage ConnectionState = " + ConnectionState, GetType().Name);
                        if (ConnectionState != SocketConnectionState.DisConnected)
                        {
                            Messenger.Default.Send(true, MessengerToken.SOCKETDISCONNECTED);
                        }
                        Windows.Web.WebErrorStatus webErrorStatus = WebSocketError.GetStatus(ex.GetBaseException().HResult);
                        ObjFactory.Instance.CreateLogger().Log("Connect 2 Ex = " + webErrorStatus, GetType().Name);

enter image description here

c#
websocket
uwp
asked on Stack Overflow Apr 14, 2020 by Ankur

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0