"newmessage.chatify" event

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
ethanlazarus
User
Posts: 63

"newmessage.chatify" event

Post by ethanlazarus »

I see the new version of PHP maker released today supports a newmessage.chatify event. I'd love to use this to give visual notification to the receiver of a message that they have a message waiting for them - open the chatify box, change the color, etc. Can anybody explain to me how to notify the logged in user they have a chatify message using this new event handler? Thanks!


arbei
User
Posts: 9384

Post by arbei »

You should be able to use it like any other jQuery event, e.g.

$(document).on("newmessage.chatify", (e, args) => {
   // console.log(args); // Check the arguments first
   // Do what you need
});

ethanlazarus
User
Posts: 63

Post by ethanlazarus »

Sorry - not understanding:

1) Suppose I want to just have an alert "New Chat Message" pop up in any part of the phpmaker project -

-Where would I put this? How exactly would I code that?

THANKS!!


arbei
User
Posts: 9384

Post by arbei »

You may add above to global Startup Script and add some code in the callback to test.


ethanlazarus
User
Posts: 63

Post by ethanlazarus »

Well, I added this to the Global startup script:

$(document).on("newmessage.chatify", (e, args) => {
   // console.log(args); // Check the arguments first
   // Do what you need
   alert("You have received a message in chat.");
});

However, no effect - what am I doing wrong?


arbei
User
Posts: 9384

Post by arbei »

ethanlazarus wrote:

// console.log(args); // Check the arguments first

Enable it and check if there is any error or any info logged in the console panel (press F12 in your browser).


ethanlazarus
User
Posts: 63

Post by ethanlazarus »

Aha - yes there is an error --> failed sending the message. please check your server response. code.js:512

I've double checked permissions for the folders per the phpmaker instructions. What else might I be missing?


arbei
User
Posts: 9384

Post by arbei »

The error occurred when you try to send a new message, it was not related to folder permission unless you tried to upload an image. You should enable Debug, re-generate the site, run again and check the chat app's log file under <project folder>/laravel/storage/logs.


Post Reply