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

UsePackageHandler里收不到数据呢 #729

Closed 107295472 closed 6 months ago

107295472 commented 6 months ago
var hostBuilder = MultipleServerHostBuilder.Create()
    .AddServer<SuperSocketServiceA,TextPackageInfo, LinePipelineFilter>(builder =>
    {
        builder
        .UsePackageHandler(async (s, p) =>
        {
            await s.SendAsync(Encoding.UTF8.GetBytes(p.Text + "\r\n33333333"));
        })
        .ConfigureServerOptions((ctx, config) =>
        {
            return config.GetSection("TestServer1");
        }).ConfigureServices(
                            (hostCtx, services) =>
                            {
                                services.AddSingleton<ITest, Test>();
                            });
    })
    .AddServer<TextPackageInfo, LinePipelineFilter>(builder =>
    {
        builder
        .ConfigureServerOptions((ctx, config) =>
        {
            return config.GetSection("TestServer2");
        });
    }).Build();
await hostBuilder.RunAsync();

我想服务A用socket,服务B用websocket

107295472 commented 6 months ago

可以做到服务A socket收到数据后,给服务B websocket发送吗