Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Kerry Jiang
    @kerryjiang
    One more doc
    mago-pablo
    @mago-pablo
    Hello Kerry, I am building a Websocket Server with the dotnet core 2.0 version, I have my protocol and commands running perfectly, but if the SendAsync from server to client is a long packet, the session closes. this does not happen with short messages.
    to replicate I changed the sample Websocket Server to respond with: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    the client receives a short part of the message than closes.
    mago-pablo
    @mago-pablo
    I have tried also using the settings from the ConfigSample, and still getting the session disconnected
    Kerry Jiang
    @kerryjiang
    @mago-pablo OH, I should be able to add a test case to cover this situation
    mago-pablo
    @mago-pablo
    Thank you very much, I added an issue with the error I get when I try this.
    Kerry Jiang
    @kerryjiang
    Thank you very much, I added an issue with the error I get when I try this.
    I noticed, but I forgot to reply you. Sorry about that.
    Kerry Jiang
    @kerryjiang
    @mago-pablo the bug you mentioned has been fixed
    mago-pablo
    @mago-pablo
    thank you very much, I have validated it.
    mago-pablo
    @mago-pablo

    I have encountered another situation, but I am not sure if it by the way I am handling my commands, I have a several hundred clients connected to a ws server, and in the console I start getting the following error:
    SuperSocketService[0]
    Session[b066e6c2-6f21-48c2-8172-4c974ffd16f5]: session exception.
    SuperSocket.Server.PackageHandlingException1[SuperSocket.WebSocket.WebSocketPackage]: Session b066e6c2-6f21-48c2-8172-4c974ffd16f5 got an error when handle a package. ---> System.InvalidOperationException: Writing is not allowed after writer was completed. at System.IO.Pipelines.ThrowHelper.ThrowInvalidOperationException_NoWritingAllowed() at System.IO.Pipelines.Pipe.GetSpan(Int32 sizeHint) at SuperSocket.WebSocket.WebSocketEncoder.EncodeBinaryMessage(IBufferWriter1 writer, WebSocketMessage pack) in C:\git_opensource\SuperSocket\src\SuperSocket.WebSocket\WebSocketEncoder.cs:line 70
    at SuperSocket.WebSocket.WebSocketEncoder.Encode(IBufferWriter1 writer, WebSocketMessage pack) in C:\git_opensource\SuperSocket\src\SuperSocket.WebSocket\WebSocketEncoder.cs:line 90 at SuperSocket.Channel.PipeChannel1.WritePackageWithEncoderTPackage in C:\git_opensource\SuperSocket\src\SuperSocket.Channel\PipeChannel.cs:line 245
    at SuperSocket.Channel.PipeChannel1.SendAsync[TPackage](IPackageEncoder1 packageEncoder, TPackage package) in C:\git_opensource\SuperSocket\src\SuperSocket.Channel\PipeChannel.cs:line 229
    at ...ComandoBase1.ExecuteAsync(MySession session, MyPackageInfo package) at SuperSocket.Command.CommandMiddleware3.CommandSet1.ExecuteAsync(IAppSession session, TPackageInfo package) in C:\git_opensource\SuperSocket\src\SuperSocket.Command\CommandMiddleware.cs:line 276 at SuperSocket.Command.CommandMiddleware3.HandlePackage(IAppSession session, TPackageInfo package) in C:\git_opensource\SuperSocket\src\SuperSocket.Command\CommandMiddleware.cs:line 127
    at SuperSocket.WebSocket.Server.WebSocketPackageHandler.Handle(IAppSession session, WebSocketPackage package) in C:\git_opensource\SuperSocket\src\SuperSocket.WebSocket.Server\WebSocketPackageHandler.cs:line 168
    at SuperSocket.Server.SuperSocketService`1.HandleSession(AppSession session, IChannel channel) in C:\git_opensource\SuperSocket\src\SuperSocket.Server\SuperSocketService.cs:line 316
    --- End of inner exception stack trace ---

    When the command is processed it always responds with the await SendAsync(okmessage)

    The weird thing is, I set up another instance with another set of clients, and it does not happen, on the server I get the error, Ram starts to build up.

    I not creating this as an issue because it would seem its the client behavior, they are different versions.
    Kerry Jiang
    @kerryjiang
    There might be an issue the server still try to send data to client when the connection is closed already. Probably it was caused by the client's behavior, but the server can should handle it correctly.
    mago-pablo
    @mago-pablo

    I added a flag to avoid the send if the session is closed:
    if(session.Handshaked && session.State == SuperSocket.SessionState.Connected)
    await session.SendAsync(ok);

    but still get the error, unless I am recevieng to many messages and the session closes during the process of the comand?

    I also wrapped it in a try catch block and in the exception caught also call the session close.
    Kerry Jiang
    @kerryjiang
    Jim Welch
    @jim.welch_gitlab
    Hi @kerryjiang ! I'm upgrading a .Net Framework project to .Net Core and noticed supersocket 2.0 should support .Net Core where as our current version does not appear to. However, Im not sure how best to install this as I'm used to using NuGet for all packages and I dont see version 2.0 on a NuGet repo. How can I go about converting my current Supersocket into version 2.0
    Kerry Jiang
    @kerryjiang
    @jim.welch_gitlab Hello Jim, the SuperSocket 2.o is base on .net core (netstandard2.1) completely. In Nuget, the packages of SuperSocket 2.0 can be found as multiple small packages. One of them is https://www.nuget.org/packages/SuperSocket.Server/2.0.0-beta1-01. Because they are in beta status, so you probably need check checkbox for not stable releases in your IDE to see these packages.
    The apis are different with the old version, so you have to adjust your code for SS 2.0. Anyway, just follow the documentation, samples and test cases. Ask me if you meed something you cannot figure out.
    Jim Welch
    @jim.welch_gitlab

    Thanks so much @kerryjiang ! I'm digging in now and trying to find a class list or something that can aid me in converting over the current syntax. Here are the current functions/classes Im using with version 1.0

    Classes:
    WebSocketSession
    ServerConfig
    WebSocketServer

    Functions:
    WebSocketSession.Send()
    WebSocketServer.Setup()
    WebSocketServer.Start()

    Events:
    WebSocketServer.NewSessionConnected
    WebSocketServer.SessionClosed

    kmiterror
    @kmiterror
    Hi, @kerryjiang
    I was using SuperSocket 1.6 and now I started to port my project to .net core
    This means that I used your SuperSocket 2.0 beta 3 package.
    I really like what you did, the way you implemented the commands is very elegant.
    I was able to port it real quick, first test was very promising but I'm getting client disconnects when sending messages that exceeds 65535 bytes. Client is disconnecting automatically (chrome browser).
    I tried changing the buffer sizes but it doesn't make a difference
    I'm using "session?.SendAsync(message)" where message is a string.
    Exactly same code was working on SuperSocket 1.6
    Any advice?
    Kerry Jiang
    @kerryjiang
    @kmiterror do you mean smaller messages are ok but there will be problems if the message exceeds 65535 bytes?
    kmiterror
    @kmiterror
    @kerryjiang exactly, smaller messages are going through without issues
    kmiterror
    @kmiterror
    I have prepared a testcase Let me send you a PR
    kmiterror
    @kmiterror
    I created a PR, have a look
    Kerry Jiang
    @kerryjiang
    Thanks for your PR, it helped a lot.
    I have fixed the problem
    check out the packages in myget: https://www.myget.org/feed/Packages/supersocket
    kmiterror
    @kmiterror
    wow, you are fast
    I fetched your code locally, and tests are working fine now
    I tried the 2.0.0-beta3 package from myget, but the problem is still the same
    are you sure that you have built it from latest version?
    kmiterror
    @kmiterror
    I tried with refferencing SuperSocket project in my project and then it works ok
    so either this is nuget caching issue ( I cleared all SuperSoecket packages from shared nuget fodler), or the package was built from a revision which doesn't include the fix
    kmiterror
    @kmiterror
    PS also, from the very first try, I had some issues with running SuperSocket test suite,
    I was getting error " The server returned status code '200' when status code '101' was expected.",
    it worked once I changed the port to something like 8100/8101 etc
    is there something that I'm missing?
    I'm using Windows 10 1909 + latest Visual Studio Community 2019
    Kerry Jiang
    @kerryjiang
    Probably the version number of the packages in myget wasn't change, so the assembly references were not able to be updated. Just wait for my next NuGet release.
    For the testing issue, just check if the ports 4040 and 4041 have been taken by other applications.
    ishowfun
    @ishowfun
    need udp support in clientengine
    xlegrand
    @xlegrand
    Hi all, any documentation on how to implement the business logic with Supersocket2/Websocket ? I tried creating a service with no luck so far.
    2 replies
    a6387534
    @a6387534
    Hello anyone I am getting Clear idle session error after the supersocket websocket server run for few hours
    Version: 1.6.6.1
    a6387534
    @a6387534
    I have posted the issue here: kerryjiang/SuperSocket#417
    Artyom M.
    @ScarletKuro
    Hello. How can i make udp broadcasting with 2.0?
    Kerry Jiang
    @kerryjiang
    No direct support. But you always can get socket object and do whatever you want with it.
    @a6387534 Hello, try the fix I made in the branch v1.6
    Artyom M.
    @ScarletKuro
    Any idea how to use supersocket (2.0) .UsetCommand() with simpleinjector? I saw example with Autofac but can't make it work with simpleinjector. Currently i have to use .UsePackageHandler instead to resolve my DI, but i would like to use UseCommand
    Kerry Jiang
    @kerryjiang
    Artyom M.
    @ScarletKuro
    I tried with
    container.Collection.Register(typeof(IAsyncCommand<PacketInfo>), new[] { typeof(ConfirmationCommand) });
    but had no luck
    Kerry Jiang
    @kerryjiang
    @ScarletKuro could you show me the whole piece of code how you create the host builder?
    Artyom M.
    @ScarletKuro
    will create sample project later
    Kerry Jiang
    @kerryjiang
    You better add one more test case to prove the issue