rkrasowski has asked for the wisdom of the Perl Monks concerning the following question:
Hi everybody, I am trying to use WWW::Pusher. The idea is to send messages from server to browser. I used script provided in the docs but it does not work.
The message is delivered but is "undefine". Looking more carefully I realized that message is not formatted in the proper way by WWW::Pusher.It should be formatted like this:{"message": "Test message"}. WWW::Pusher is sending only "Test Message". Looking at JavaScript console in Chrome I should have: "data":{"message":"Test message"} but I am getting only: "data":"Test message", so clearly problem with formatting the message by WWW::Pusher. So I started looking at Pusher.pm file, hoping to be able to modify it and make it to work. I tried insert : {"message": "Test message"} directly into Pusher.pm but still it is undefined. In Chrome console I am getting this: "data":"{\"message\": \"Test message\"}". So the question: how to format this message so it will be properly sent by WWW::Pusher ?? Thanks like always, Robertuse WWW::Pusher; my $pusher = WWW::Pusher->new( auth_key => 'YOUR API KEY', secret => 'YOUR SECRET', app_id => 'YOUR APP ID', channel => 'test_channel' ); my $response = $pusher->trigger(event => 'my_event', data => 'Tes +t message'); my $sock_auth = $pusher->socket_auth('socket_auth_key');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WWW::Pusher - does not send a message
by choroba (Cardinal) on Jun 14, 2015 at 06:44 UTC | |
by rkrasowski (Sexton) on Jun 14, 2015 at 19:13 UTC | |
by choroba (Cardinal) on Jun 14, 2015 at 19:48 UTC | |
by rkrasowski (Sexton) on Jun 15, 2015 at 23:20 UTC |