NAME
Terse::WebSocket - Lightweight WebSockets
VERSION
Version 0.114
SYNOPSIS
package Chat;
use base 'Terse';
sub auth {
my ($self, $t, $session) = @_;
return 0 if $t->params->not;
return $session;
}
sub chat {
my ($self, $t) = @_;
$self->webchat->{$t->sid->value} = $t->websocket(
connect => {
my ($websocket) = @_;
$websocket->send('Hello');
},
recieve => {
my ($websocket, $message) = @_;
$websocket->send($message); # echo
},
error => { ... },
disconnect => { ... }
);
}
1;
PERL5LIB=lib:./t/lib plackup -s Starman t/lib/Chat.psgi
CONNECT ws://localhost:5000?req=chat;
AUTHOR
LNATION, <email at lnation.org>