Group
Extension

Matches 5

Finance-Bitcoin-Feed ( B/BI/BINARY/Finance-Bitcoin-Feed-0.05.tar.gz, BINARY, 2015; MetaCPAN )
Finance-Bitcoin-Feed/lib/Finance/Bitcoin/Feed/Pusher.pm ( view source; MetaCPAN )
nyEvent::Handle;
use Protocol::WebSocket::Handshake::Client;
use Protocol::WebSocket::Frame;

use JSON;
use URI;
use Data::Dumper;

use constant CHANNELS => qw(
    order_book
    live_trades
);

use 
 to move and rewrite into your own module.
# within these subroutines you will have access to the json response in a hash format.
sub trade {
    my $self = shift;
    my $data = shift;
    warn Data:

        while (my $msg = $self->frame->next) {
            my $d;
            eval { $d = $self->json->decode($msg); } or do {
                my $e = $@;
                warn $self->now . ' - error:
Finance-Bitcoin-Feed ( B/BI/BINARY/Finance-Bitcoin-Feed-0.05.tar.gz, BINARY, 2015; MetaCPAN )
Finance-Bitcoin-Feed/lib/Finance/Bitcoin/Feed/Site/LakeBtc/Socket.pm ( view source; MetaCPAN )
package Finance::Bitcoin::Feed::Site::LakeBtc::Socket;

use JSON;
use Mojo::Base 'Mojo::Transaction::WebSocket';
use Scalar::Util qw(weaken);
has 'owner';

sub configure {
    my $self  = shift;
    m
er);
    weaken($self->{owner});

    # call parse when receive text event
    $self->on(
        json => sub {
            my ($self, $message) = @_;
            $message = $message->[0];
           
       $self->on(
                'setup',
                sub {
                    $self->send({json => ['websocket_rails.subscribe', {data => {channel => $channel}}]});
                });
        
Finance-Bitcoin-Feed ( B/BI/BINARY/Finance-Bitcoin-Feed-0.05.tar.gz, BINARY, 2015; MetaCPAN )
Finance-Bitcoin-Feed/lib/Finance/Bitcoin/Feed/Site/CoinSetter/Socket.pm ( view source; MetaCPAN )
package Finance::Bitcoin::Feed::Site::CoinSetter::Socket;
use JSON;
use Scalar::Util qw(weaken);

use Mojo::Base 'Mojo::Transaction::WebSocket';

has 'owner';

sub configure {
    my $self  = shift;
 


    my ($tx, $data) = @_;

    my @packets = ('disconnect', 'connect', 'heartbeat', 'message', 'json', 'event', 'ack', 'error', 'noop');

    my $regexp = qr/([^:]+):([0-9]+)?(\+)?:([^:]+)?:?([\s\S]
:102.43}]}"
    elsif ($packet->{type} eq 'event') {
        eval {
            my $opts = decode_json($data);
            $packet->{name} = $opts->{name};
            $packet->{args} = $opts->{args};
Finance-Bitcoin-Feed ( B/BI/BINARY/Finance-Bitcoin-Feed-0.05.tar.gz, BINARY, 2015; MetaCPAN )
Finance-Bitcoin-Feed/lib/Finance/Bitcoin/Feed/Site/BtcChina/Socket.pm ( view source; MetaCPAN )
package Finance::Bitcoin::Feed::Site::BtcChina::Socket;

use JSON;
use Mojo::Base 'Mojo::Transaction::WebSocket';
use Scalar::Util qw(weaken);
has 'owner';
has 'ping_interval';
has 'ping_timeout';
has
 $json_data = decode_json($body);

        #session_id useless ?

        $self->ping_interval($json_data->{pingInterval})
            if $json_data->{pingInterval};
        $self->ping_timeout($json_
data->{pingTimeout})
            if $json_data->{pingTimeout};
        $self->last_pong_at(time());
        $self->last_ping_at(time());
        $self->emit('setup');
    }

    # pong
    elsif ($cod
Finance-Bitcoin-Feed ( B/BI/BINARY/Finance-Bitcoin-Feed-0.05.tar.gz, BINARY, 2015; MetaCPAN )
Finance-Bitcoin-Feed/lib/Finance/Bitcoin/Feed/Site/Hitbtc.pm ( view source; MetaCPAN )
';

sub new {
    my $class = shift;
    my $self  = $class->SUPER::new(@_);
    $self->on('json', \&on_json);

    return $self;
}

sub go {
    my $self = shift;
    $self->SUPER::go(@_);
    $self-
n(
                json => sub {
                    my ($tx, $hash) = @_;
                    $self->emit('json', $hash);
                });
        });
    return;
}

sub on_json {
    my ($self, $

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.