Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

WebSocketConnection.Send exception "Buffer maximum length exceeded (18730 vs 16384)" #6

Open
deniszykov opened this issue Mar 20, 2016 · 3 comments

Comments

@deniszykov
Copy link

There is an artificial restriction on sending messages. The RFC6455 says nothing about such size of messages (http://tools.ietf.org/html/rfc6455#section-5.2). In addition, Send does not accept Streams, but only buffers and strings.

@paulmrozowski
Copy link

You can set the max message size on the server:

using (var server = new TcpServer())
{
    server.MaxIncomingQuota = 32768;
    server.MaxOutgoingQuota = 1048576;
}

Yeah, I didn't see a way to pass streams, which would be really useful.

@mgravell
Copy link
Contributor

Re streams: it should be pretty trivial to write an extension method (or
regular utility method) that loops a buffer over a stream; we could add it
as an API, of course.
On 28 Mar 2016 9:14 p.m., "Paul Mrozowski" [email protected] wrote:

You can set the max message size on the server:

using (var server = new TcpServer())
{
server.MaxIncomingQuota = 32768;
server.MaxOutgoingQuota = 1048576;
}

Yeah, I didn't see a way to pass streams, which would be really useful.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#6 (comment)

@paulmrozowski
Copy link

Ah, I completely misread the Send() method. It initially appeared to me that it was always expecting a string, then converting that to a byte array of chars and adding to the frame/batch (I thought it was really weird you expected an object). I skipped over the code at the end where you check if its a string (and < the max frame size) or if it's a byte[]. Yeah, if I can pass a byte[] in than that mostly eliminates the need for a stream for me. Calling .ToArray() is hardly a big deal and having it sent as binary data isn't an issue for me.

It's interesting that text data requires multiple frames w/continuations but binary data doesn't.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants