【发布时间】:2021-06-15 07:46:51
【问题描述】:
我想知道:WebSocketSharp 的最大短信大小是多少? 如果消息字符串超过最大大小,是否会被拆分成小块数据,并通过 websocket 发送到服务器端?
【问题讨论】:
标签: c# .net websocket size message
我想知道:WebSocketSharp 的最大短信大小是多少? 如果消息字符串超过最大大小,是否会被拆分成小块数据,并通过 websocket 发送到服务器端?
【问题讨论】:
标签: c# .net websocket size message
查看source code 似乎没有最大尺寸。有一个内部字段FragmentLength 带有以下注释
/// <summary>
/// Represents the length used to determine whether the data should be fragmented in sending.
/// </summary>
/// <remarks>
/// <para>
/// The data will be fragmented if that length is greater than the value of this field.
/// </para>
/// <para>
/// If you would like to change the value, you must set it to a value between <c>125</c> and
/// <c>Int32.MaxValue - 14</c> inclusive.
/// </para>
/// </remarks>
【讨论】:
我认为说 WebSocket 具有最大消息长度是错误的。有一些buffer,如果您的信息不止于此,您将按部分收到您的信息。但只有最后一部分会有EndOfMessage=true。
【讨论】:
我觉得比较合适的方式是直接在github上问这个问题https://github.com/sta/websocket-sharp
【讨论】: