Question: When using Perl's [Websocket server](http://search.cpan.org/~topaz/Net-WebSocket-Server-0.001003/lib/Net/WebSocket/Server.pm), if I send a json message using send\_utf8 that's longer than about 16,000 characters, it causes the connection to the websocket to be killed in Chrome with the message:

"Could not decode a text frame as UTF-8".

Is there some restriction on the length of messages that can be sent by this Websocket server, and is there a way of getting around this restriction?

Answer: 
It fails because (as of 0.001003) Net::WebSocket::Server::Connection initializes its Protocol::WebSocket::Frame objects without setting "max\_payload\_size" which overrides the 65535 byte limit. The problem can be easily resolved if the module author updates those calls to allow larger buffers, or better, to pass through a user defined value.
Apparently, it's possible to set the payload size in the Protocol::WebSocket::Frame constructor (<https://github.com/vti/protocol-websocket/issues/24#issuecomment-27095561>).

Unfortunately the docs on cpan seem to be missing that information.

Try this:

```
$hs->build_frame(buffer => $my_data, max_payload_size => 200000)->to_bytes);

```