… | |
… | |
14 | |
14 | |
15 | cf::client->attach ( |
15 | cf::client->attach ( |
16 | on_connect => sub { |
16 | on_connect => sub { |
17 | my ($ns) = @_; |
17 | my ($ns) = @_; |
18 | |
18 | |
|
|
19 | Scalar::Util::weaken (my $weakns = $ns); |
|
|
20 | |
19 | $ns->{id} = "a"; |
21 | $ns->{id} = "a"; |
|
|
22 | $ns->{json_coder}->filter_json_single_key_object (__widget_ref__ => sub { |
|
|
23 | # cannot deserialise ATM |
|
|
24 | undef |
|
|
25 | }); |
20 | }, |
26 | }, |
21 | ); |
27 | ); |
22 | |
28 | |
23 | sub csc_update_stats { |
29 | sub csc_update_stats { |
24 | my ($ns) = @_; |
30 | my ($ns) = @_; |
… | |
… | |
150 | sub msg { |
156 | sub msg { |
151 | my ($self, $type, %msg) = @_; |
157 | my ($self, $type, %msg) = @_; |
152 | |
158 | |
153 | if (my $ns = shift->{ns}) { |
159 | if (my $ns = shift->{ns}) { |
154 | $msg{msgtype} = $type; |
160 | $msg{msgtype} = $type; |
155 | $ns->send_packet ("ext " . cf::to_json \%msg); |
161 | $ns->send_packet ("ext " . $ns->{json_coder}->encode (\%msg)); |
156 | } |
162 | } |
157 | } |
163 | } |
158 | |
164 | |
159 | sub new { |
165 | sub new { |
160 | my ($self, $class, %args) = @_; |
166 | my ($self, $class, %args) = @_; |