kerryjiang / SuperSocket

SuperSocket is a light weight, cross platform and extensible socket server application framework.
Apache License 2.0
3.95k stars 1.15k forks source link

Problems:1.6.6.1 Upgrade to 2.0.0-beta.11 #614

Open sjTwoDogSon opened 2 years ago

sjTwoDogSon commented 2 years ago

1.6.6.1 version has 'InternalHandleUnknownRequest' and 'HandleUnknownRequest' in AppSession however, version 2.0.0-beta.11 does not In version 1.6.6.1, I used it to filter instructions not requested by standard protocols,is there a method similar to this in version 2.0.0-beta.11? I can't find it,I also need to record the address and SessionID of the request I hope you can help me out of your busy schedule. Thank you very much

chucklu commented 2 years ago

No, when get command by key failed, it will just return. https://github.com/kerryjiang/SuperSocket/blob/master/src/SuperSocket.Command/CommandMiddleware.cs#L199

protected virtual async ValueTask HandlePackage(IAppSession session, TPackageInfo package)
        {
            if (!_commands.TryGetValue(package.Key, out ICommandSet commandSet))
            {
                return;
            }

            await commandSet.ExecuteAsync(session, package);
        }
chucklu commented 2 years ago

And in v1.6 https://github.com/kerryjiang/SuperSocket/blob/v1.6/SocketBase/AppServerBase.cs#L1287

var commandProxy = GetCommandByName(requestInfo.Key);

                if (commandProxy != null)
                {}
  else
                {
                    session.InternalHandleUnknownRequest(requestInfo);
                }
sjTwoDogSon commented 2 years ago

sorry, I want to directly process in the customized session. is there any good way

chucklu commented 2 years ago

Then you have to write your own code, as SuperSocket does not support the feature you required.