Skip Menu |

This queue is for tickets about the Net-Async-WebSocket CPAN distribution.

Report information
The Basics
Id: 88313
Status: open
Worked: 1 hour (60 min)
Priority: 0/
Queue: Net-Async-WebSocket

People
Owner: Nobody in particular
Requestors: janhouse [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Payload is too big.
Date: Sat, 31 Aug 2013 21:30:42 +0300
To: bug-Net-Async-WebSocket [...] rt.cpan.org
From: Jānis Jansons <janhouse [...] gmail.com>
I am getting this when using send_frame with Net::Async::WebSocket::Server. Payload is too big. Send shorter messages or increase max_payload_size at /home/builder/.perl/perl/lib/Protocol/WebSocket/Frame.pm line 232. I think that it should automagically split it in chunks and do the "behind the scenes" work. It not, there isn't really any easy way to do it manually using Net::Async::WebSocket::Server.
On Sat Aug 31 14:31:08 2013, janhouse@gmail.com wrote: Show quoted text
> I am getting this when using send_frame with Net::Async::WebSocket::Server. > > Payload is too big. Send shorter messages or increase max_payload_size at > /home/builder/.perl/perl/lib/Protocol/WebSocket/Frame.pm line 232. > > > I think that it should automagically split it in chunks and do the "behind > the scenes" work. It not, there isn't really any easy way to do it manually > using Net::Async::WebSocket::Server.
The trouble with splitting it magically like that is that WebSockets are supposed to preserve message boundaries, so the other end would have to recombine them somehow. If you are trying to send payloads larger than can fit in a single frame payload, then you'll have to implement some kind of fragmentation/reassembly scheme yourself. It should be relatively simple for you to do that (perhaps preceed each message with a simple bitflag to say whether it should be combined with more messages coming, or if it is the last). I could put together a simple example of this, but since it would be some custom framing atop the basic WebSocket itself, that sort of thing couldn't be universally added. -- Paul Evans
Subject: Re: [rt.cpan.org #88313] Payload is too big.
Date: Sun, 1 Sep 2013 10:36:52 +0300
To: bug-Net-Async-WebSocket [...] rt.cpan.org
From: Jānis Jansons <janhouse [...] gmail.com>
After reading some posts on Stack Overflow, it still seems like it still should be able to handle larger messages without making any hacks on the JavaScript side, so I am still not convinced that this isn't a bug. http://stackoverflow.com/a/13011241/1246756 and http://stackoverflow.com/a/14119129/1246756 On 31 August 2013 22:50, Paul Evans via RT < bug-Net-Async-WebSocket@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=88313 > > > On Sat Aug 31 14:31:08 2013, janhouse@gmail.com wrote:
> > I am getting this when using send_frame with
> Net::Async::WebSocket::Server.
> > > > Payload is too big. Send shorter messages or increase max_payload_size at > > /home/builder/.perl/perl/lib/Protocol/WebSocket/Frame.pm line 232. > > > > > > I think that it should automagically split it in chunks and do the
> "behind
> > the scenes" work. It not, there isn't really any easy way to do it
> manually
> > using Net::Async::WebSocket::Server.
> > The trouble with splitting it magically like that is that WebSockets are > supposed to preserve message boundaries, so the other end would have to > recombine them somehow. If you are trying to send payloads larger than can > fit in a single frame payload, then you'll have to implement some kind of > fragmentation/reassembly scheme yourself. > > It should be relatively simple for you to do that (perhaps preceed each > message with a simple bitflag to say whether it should be combined with > more messages coming, or if it is the last). > > I could put together a simple example of this, but since it would be some > custom framing atop the basic WebSocket itself, that sort of thing couldn't > be universally added. > > -- > > Paul Evans >
This has to do with the max_payload_size in Protocol::WebSocket::Frame. https://metacpan.org/pod/Protocol::WebSocket::Frame It can be set when using the send_frame sub from Net::Async::WebSocket::Protocol. If you look at the source, you will see it accepts @_ as the constructor params. https://metacpan.org/source/Net::Async::WebSocket::Protocol Reviewing Protocol::WebSocket::Frame, you can set the what you're sending as the buffer param and max_payload_size to undef to ignore limitations. It should look like this: $connection->send_frame(buffer => $self->encoder->encode($resp), max_payload_size => undef); This should eliminate the error message. It's not documented at all and took me a while poking around to figure it out.