Quantcast
Channel: WebSocket4Net
Viewing all 109 articles
Browse latest View live

Reviewed: WebSocket4Net 0.14 (okt 04, 2016)

$
0
0
Rated 5 Stars (out of 5) - Very good. Better than default .Net ClientWebSocket

Created Unassigned: Missing reason phrase breaks the handshake validation [57]

$
0
0
[ValidateVerbLine](https://websocket4net.codeplex.com/SourceControl/latest#WebSocket4Net/Protocol/ProtocolProcessorBase.cs) fails if the number of 'words' is less than 3.
[rfc2616](https://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html) defines the reason phrase as optional(note the * at the beginning)
```
Reason-Phrase = *<TEXT, excluding CR, LF>
```

Software like [tomcat](https://github.com/spring-projects/spring-boot/issues/6548) is not sending the reason phrase anymore to save traffic and validation fails.

Created Unassigned: Websocket error.. connects in 3rd attempt [58]

$
0
0
We are using websocket4net (v 0.14.1) in our application. This issue of websocket error unexpectedly is happening on Windows 7 machine only and not with windows 8 or 10.

On windows 7 machine we get following websocket exception..

Web socket error: System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: The message received was unexpected or badly formatted^M
--- End of inner exception stack trace ---^M
at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)^M
at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)^M
at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)^M
at SuperSocket.ClientEngine.SslStreamTcpSession.OnAuthenticated(IAsyncResult result)^M


i have seen the wireshark traces but nothing has helped yet. Wireshark traces are attached with server ip address = 123.255.13.242 and client IP address = 10.221.12.50 and clients tries websocket connection at port 36008. Our application tries for a websocket connection to the server and get this exception always in first 2 attempt, then the websocket connection is established in 3rd attempt

The websocket connection connects to server port 36008 using TLS v1.2 for the connection with the server.

Commented Unassigned: Websocket error.. connects in 3rd attempt [58]

$
0
0
We are using websocket4net (v 0.14.1) in our application. This issue of websocket error unexpectedly is happening on Windows 7 machine only and not with windows 8 or 10.

On windows 7 machine we get following websocket exception..

Web socket error: System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: The message received was unexpected or badly formatted^M
--- End of inner exception stack trace ---^M
at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)^M
at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)^M
at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)^M
at SuperSocket.ClientEngine.SslStreamTcpSession.OnAuthenticated(IAsyncResult result)^M


i have seen the wireshark traces but nothing has helped yet. Wireshark traces are attached with server ip address = 123.255.13.242 and client IP address = 10.221.12.50 and clients tries websocket connection at port 36008. Our application tries for a websocket connection to the server and get this exception always in first 2 attempt, then the websocket connection is established in 3rd attempt

The websocket connection connects to server port 36008 using TLS v1.2 for the connection with the server.
Comments: Please provide your comments ! Thanks, Abhiraj

New Post: corrupted message during the initial message after subscription

$
0
0
Hi,

I'm receiving corrupted message for the first message i got, for the subsequent message, they are able to read. I'm trying to listen this via a console in C#.

When I listen to the same channel via browser, everything is working perfectly.

Image

The difference i saw between the first and subsequent frames, are the value of rsvBit1. The first frame is true, while others are false.
Could this be the reason?


Any idea how to solve this?

Appreciate the help! Thank you!

New Post: Windows Authentication

$
0
0
Can WebSocket4Net be configured to use windows authentication?
We have a WPF application that needs to connection secured by windows auth(client requirement).

I am assuming in the constructor I have to send a custom header and send the default credentials through.
So I added this and tried sending the value I pulled from a different web request to the same service that worked and I get an unauthorized.

KeyValuePair<string, string> ("Authorization", "Negotiate ?????What goes here?????") or is
there a different way to do this.

I used the example located in this issue to try and get it working.
https://websocket4net.codeplex.com/workitem/21

With WebClients you just set UserDefaultCredentials = true;
WCF you configure the client/server bindings.

New Post: using https and http

New Post: WebSocket4Net will not connect

$
0
0
I have a client app using WebSocket4Net and a server app running SuperSocket. The server is receiving the connction request but the client is state is stuck in Connecting. It doesnt recive any conncetions from the server unless I close the server and then it registers the closed event. Is there anything obvious I am missing ? thanks in advance for any help.

Here is the code, First a management class:-

class DataManager { #region Singleton
public static DataManager myInstance;

public static DataManager GetInstance()
{
    if (myInstance == null)
    {
        myInstance = new DataManager();
    }

    return myInstance;
}

private DataManager()
{ }

#endregion




string ip = "ws://127.0.0.1:57000";
public WebSocket websocket;

public void openConnection()
{
    websocket = new WebSocket(ip);

    websocket.Opened += new EventHandler(websocket_Opened);
    websocket.Error += new EventHandler<ErrorEventArgs>(websocket_Error);
    websocket.Closed += new EventHandler(websocket_Closed);
    websocket.MessageReceived += new EventHandler<WebSocket4Net.MessageReceivedEventArgs>(websocket_MessageReceived);
    websocket.DataReceived += new EventHandler<DataReceivedEventArgs>(websocket_MessageReceived);

    websocket.Open();

}


private void websocket_MessageReceived(object sender, EventArgs e)
{

    int x = 1;
    throw new NotImplementedException();

}

private void websocket_Closed(object sender, EventArgs e)
{

    throw new NotImplementedException();
}

private void websocket_Error(object sender, ErrorEventArgs e)
{
    throw new NotImplementedException();
}

private void websocket_Opened(object sender, EventArgs e)
{
    //TODO logic for socket opened
    int x = 1;
}
}
Client:

public MainWindow()
    {
        InitializeComponent();
        Task socket = Task.Run(() => DataManager.GetInstance().openConnection());
        // socket.Start();

        while (true)
        {
            System.Threading.Thread.Sleep(500);
            string connection = DataManager.GetInstance().websocket.State.ToString();
        }

    }
And the server:

public void startSocket()
    {


        var appServer = new AppServer();

        // setup the port
        if (!appServer.Setup(57000))
        {
            // TODO add to loggin
        }

        // start the server
        if (!appServer.Start())
        {
            // TODO add to loggin
        }

        appServer.NewSessionConnected += new SessionHandler<AppSession>(socket_NewSessionConnection);

        appServer.NewRequestReceived += new RequestHandler<AppSession, SuperSocket.SocketBase.Protocol.StringRequestInfo>(onData);


    }

    private void onData(AppSession session, StringRequestInfo requestInfo)
    {
        //logic for income data 
        int x = 1;

    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="session"></param>
    private void socket_NewSessionConnection(AppSession session)
    {
        // implement logic for checking username and password
        int x = 1;


            Thread.Sleep(1000);
            session.Send("success");
            if (session.TrySend("test"))
            {
                x = 1;
            }



        session.Send("success");
        if (session.TrySend("sasasasasa"))
        {
            x = 1;
        }  
    }

Created Unassigned: Release 0.15.0 completely broken for mono [59]

$
0
0
No errors, no events, just silence after Open call.
This sample works like a charm on Win but hangs with no errors on Centos 6.9 + mono 4.2.4.
```
class Program {
static WebSocket4Net.WebSocket ws;

static void Main(string[] args) {
ws = new WebSocket4Net.WebSocket("ws://myappserver/");
ws.Opened += Ws_Opened;
ws.MessageReceived += Ws_MessageReceived;
ws.DataReceived += Ws_DataReceived;
ws.Error += Ws_Error;
ws.Open();
Thread.Sleep(Timeout.Infinite);
}

private static void Ws_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e) {
Console.WriteLine($"ERROR - {e.Exception.Message}");
}

private static void Ws_DataReceived(object sender, WebSocket4Net.DataReceivedEventArgs e) {
Console.WriteLine($"Received bin '{Encoding.UTF8.GetString(e.Data)}'");
}

private static void Ws_MessageReceived(object sender, WebSocket4Net.MessageReceivedEventArgs e) {
Console.WriteLine($"Received msg '{e.Message}'");
}

private static void Ws_Opened(object sender, EventArgs e) {
Console.WriteLine("Connected");
ws.Send("<request cm=\"ping\"/>");

}
}
```

ws://myappserver/ is definitly accesible and working. Downgrade to 0.14.0 fixes the problem.
Viewing all 109 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>