gs;
our $VERSION = '0.10';
use overload '&{}' => sub { shift->to_app(@_) }, fallback => 1;
use JSON ();
use Digest::MD5 ();
use Scalar::Util ();
use Plack::Middleware::Chunked;
use SockJS
fo = JSON::encode_json(
{
websocket => $self->{websocket} ? JSON::true
: JSON::false,
cookie_needed => $self->{cookie} ? JSON::true
: JSON::fa
}
);
return [
200,
[
'Content-Type' => 'application/json; charset=UTF-8',
'Content-Length' => length($info),
],
[$info]
];
use warnings;
use base 'SockJS::Transport::Base';
use Encode ();
use IO::Compress::Deflate;
use JSON ();
use AnyEvent::Handle;
use Protocol::WebSocket::Handshake::Server;
sub new {
my $self = s
eq 'websocket') {
my $json = JSON->new->utf8->allow_nonref(0);
eval { $message = $json->decode($message) } || do {
#warn "JSON error: $@\n";
re
package SockJS::Transport::JSONPSend;
use strict;
use warnings;
use base 'SockJS::Transport::Base';
use JSON ();
sub new {
my $self = shift->SUPER::new(@_);
push @{$self->{allowed_methods
q 'ARRAY';
my $json = JSON->new->utf8->allow_nonref(0);
my $message;
eval { $message = $json->decode($data) } || do {
return $self->_return_error('Broken JSON encoding.');
};
SockJS::Transport::XHRSend;
use strict;
use warnings;
use base 'SockJS::Transport::Base';
use JSON ();
sub new {
my $self = shift->SUPER::new(@_);
push @{$self->{allowed_methods}}, 'POST
gth $data;
my $json = JSON->new->utf8->allow_nonref(0);
my $message;
eval { $message = $json->decode($data) } || do {
return $self->_return_error('Broken JSON encoding.');
};
package SockJS::Session;
use strict;
use warnings;
use JSON ();
use Encode ();
sub new {
my $class = shift;
my (%params) = @_;
my $self = {};
bless $self, $class;
$self->{id}
encode('UTF-8', $message) if Encode::is_utf8($message);
}
else {
$message = 'a' . JSON->new->ascii(1)->encode([@_]) if @_;
}
return $self->{conn}->write($message);
}
sub clos