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.

use 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');
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, Robert


In reply to WWW::Pusher - does not send a message by rkrasowski

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.