uperl / AnyEvent-WebSocket-Client

WebSocket client for AnyEvent
9 stars 10 forks source link

sub protocols? #27

Closed plicease closed 8 years ago

plicease commented 8 years ago

This came in from an email from a user.

If you use JavaScript (Firefox browser) specified subprotocol
is very simple:
var mySocket = new WebSocket('wss://www.example.com', 'my-subprotocol');
or:
var mySocket = new WebSocket('wss://www.example.com', ['my-subprotocol',my-subprotocol2']);

Whe I use Protocol::WebSocket::Client, I must use this "hack":
my $client = Protocol::WebSocket::Client->new(
   url => 'wss://www.example.com',
   version => '13'
);
$client->{hs}->req->fields->{'sec-websocket-protocol'
}='my-subprotocol';

When I use AnyEvent::WebSocket::Client, I don't know how specify
subprotocol.
plicease commented 8 years ago

I think this is doable with the public interface.

plicease commented 8 years ago

I believe this capability is available in the dev release 0.35_01, now on its way to CPAN. If it still looks like a good idea in a couple of days I will release a production version.