Net::WAMP::RawSocket
Client:
my $rs = Net::WAMP::RawSocket::Client->new( #required io => IO::Framed::ReadWrite->new( $inet ), #optional max_pings => 10, max_receive_length => 2**23, #default ); #msgpack is also accepted $rs->send_handshake( serialization => 'json', #default ); $rs->verify_handshake(); $rs->send_message('This is a message.); my $msg_txt = $rs->get_next_message();
Server:
my $rs = Net::WAMP::RawSocket::Server->new( #required io => IO::Framed::ReadWrite->new( $inet ), #optional max_pings => 10, max_receive_length => 2**23, #default ); $rs->receive_and_answer_handshake(); $rs->send_message('This is a message.); my $msg_txt = $rs->get_next_message();
This module implements WAMP’s RawSocket protocol. It’s a simpler—and hopefully faster—protocol for speaking to a WAMP server when you have a raw TCP connection as opposed to a web browser.
Note that one of RawSocket’s limitations is a hard upper limit (16 MiB) on message size: if you want to send or receive single messages of over 16 MiB, you’ll need some other transport mechanism besides RawSocket.
Instantiates the relevant class. %OPTS are:
max_receive_length As per the protocol specification, this must be a power of 2 from 512 (2**9) to 16,777,216 (2**24), inclusive.
max_receive_length
max_pings The number of pings to allow unanswered before we give up on the connection.
max_pings
Sends a regular message.
Returns the next message string, or undef if no message is available. This will also (silently) consume any PONG messages that may arrive.
Run this when your read timeout expires to send a PING message.
json or msgpack.
json
msgpack
The maximum bytes that the connection’s peer is willing to receive in a single RawSocket frame.
To install Net::WAMP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::WAMP
CPAN shell
perl -MCPAN -e shell install Net::WAMP
For more information on module installation, please visit the detailed CPAN module installation guide.