xljiulang / kestrelapp Goto Github PK
View Code? Open in Web Editor NEW基于Kestrel的网络编程应用示例
License: MIT License
基于Kestrel的网络编程应用示例
License: MIT License
目前项目使用dotnetty实现前后端的数据交互,如果换成Kestrel,应该如何实现呢,我看到源码里面没有ws://开头的websocket服务
public override async Task OnConnectedAsync(ConnectionContext connection)
{
var input = connection.Transport.Input;
try
{
while (true)
{
var result = await input.ReadAsync(connection.ConnectionClosed);
if (result.IsCanceled) { break; }
var buffer = result.Buffer;
logger.LogInformation($"read buffer of length {buffer.Length}");
foreach (var mem in buffer)
{
await connection.Transport.Output.WriteAsync(mem);
}
input.AdvanceTo(buffer.End);
}
}
catch(Exception e)
{
logger.LogInformation(e, "some exception");
}
}
我试着用客户端发了1mb的message,服务器分了好多次收到。
无论发字符串还是二进制数据,收到的都是字符串。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.