我想知道:WebSocketSharp的最大文本消息大小是多少?如果消息字符串超过了最大大小,它会被分割成小块数据,并通过websocket发送到服务器端吗?
查看源代码,似乎没有最大大小。有一个内部字段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有一些最大长度的消息是错误的。有一些缓冲区,如果你的消息超过这个缓冲区,你会分部分得到你的消息。但只有最后一部分的EndOfMessage=true。
我认为合适的方法是直接在github上问这个问题https://github.com/sta/websocket-sharp