| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
219593
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
45
|
|
|
2
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
83
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use Future::AsyncAwait; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
8
|
|
|
8
|
|
13
|
async sub app { |
|
6
|
8
|
|
|
|
|
16
|
my ($scope, $receive, $send) = @_; |
|
7
|
|
|
|
|
|
|
|
|
8
|
8
|
100
|
|
|
|
82
|
die "Unsupported scope type: $scope->{type}" if $scope->{type} ne 'websocket'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
4
|
|
|
|
|
8
|
my $event = await $receive->(); |
|
11
|
4
|
50
|
|
|
|
82
|
die "Expected websocket.connect" if $event->{type} ne 'websocket.connect'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
4
|
|
|
|
|
15
|
await $send->({ type => 'websocket.accept' }); |
|
14
|
|
|
|
|
|
|
|
|
15
|
4
|
|
|
|
|
121
|
while (1) { |
|
16
|
9
|
|
|
|
|
185
|
my $frame = await $receive->(); |
|
17
|
9
|
100
|
|
|
|
488
|
if ($frame->{type} eq 'websocket.receive') { |
|
|
|
50
|
|
|
|
|
|
|
18
|
5
|
|
|
|
|
6
|
my %payload; |
|
19
|
5
|
100
|
|
|
|
12
|
if (defined $frame->{text}) { |
|
|
|
50
|
|
|
|
|
|
|
20
|
4
|
|
|
|
|
11
|
$payload{text} = "echo: $frame->{text}"; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
elsif (defined $frame->{bytes}) { |
|
23
|
1
|
|
|
|
|
3
|
$payload{bytes} = $frame->{bytes}; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
else { |
|
26
|
0
|
|
|
|
|
0
|
next; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
5
|
|
|
|
|
21
|
await $send->({ type => 'websocket.send', %payload }); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
elsif ($frame->{type} eq 'websocket.disconnect') { |
|
31
|
4
|
|
|
|
|
17
|
last; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
\&app; # Return coderef when loaded via do |