Subject: | Proposed documentation change for Net::Async::WebSocket::Client |
I've just got some code based upon Net::Async::WebSocket::Client working against Google's Chrome browser, and I'd like to suggest a change in the documentation which might make it easier for other people to use this module in the future.
The problem I encountered was that the form of the send_frame() function given in the synopsis didn't appear to cause any effect on the server. I finally discovered that the send_frame() should include the parameter "masked => 1" and use the named parameter "buffer" to indicate the data to include in the frame.
Given this, I'd like to suggest a change in the example client in the SYNOPSIS from:
"""
$client->connect(
host => $HOST,
service => $PORT,
url => "ws://$HOST:$PORT/",
on_connected => sub {
$client->send_frame( "Hello, world!\n" );
},
on_connect_error => sub { die "Cannot connect - $_[-1]" },
on_resolve_error => sub { die "Cannot resolve - $_[-1]" },
);
"""
to:
"""
$client->connect(
host => $HOST,
service => $PORT,
url => "ws://$HOST:$PORT/",
on_connected => sub {
$client->send_frame(
masked => 1,
buffer => "Hello, world!\n"
);
},
on_connect_error => sub { die "Cannot connect - $_[-1]" },
on_resolve_error => sub { die "Cannot resolve - $_[-1]" },
);
"""
Cheers