Toast message with PHP

2,252 views
Skip to first unread message

loto...@yahoo.ro

unread,
Jan 28, 2015, 1:58:53 PM1/28/15
to realtime-...@googlegroups.com
It is possible to send toast message with PHP ?

For javascript i have this :

var toastMessages = {
	html: {
		title: "Title - HTML Toast",
		text: "Text - HTML Toast",
		destinationUrl: "http://www.xrtml.org",

	}
};


function sendToast(type) {
	var message = xRTML.MessageManager.create({
		trigger: "myTrigger",
		action: "",
		data: toastMessages[type]
	});
	xRTML.ConnectionManager.sendMessage({ connections: ["myConnection"], channel: "myChannel", content: message });
};

But how can be done for php ?


Thanks.

I`m searching for about 5 days and i didnt find nothing.

Thanks.

João Parreira

unread,
Jan 28, 2015, 2:16:34 PM1/28/15
to realtime-...@googlegroups.com
Hi,
xRTML uses the Realtime Messaging service and was mainly built for JavaScript usage thought it's JavaScript library.
Since it has a special message format and no PHP library you need to send a "raw" Realtime message using the xRTML message format through the Realtime Messaging PHP.

(I'm assuming you have no issues with sending a Realtime message using the PHP SDK)

For the example in your question you need to send the following JSON message to the channel myChannel:

{"xrtml":{"t":"myTrigger","a":"","d":{"title":"Title - HTML Toast","text":"Text - HTML Toast","displayBanner":true,"bannerType":"html","destinationUrl":"http://www.xrtml.org","bannerContent":"<div><center>This is a test.</center></div>","metaData":"RandomMetaData"}}}

Let me know if this worked for you.

Regards
Joao



--
You received this message because you are subscribed to the Google Groups "Realtime Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to realtime-framew...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

loto...@yahoo.ro

unread,
Jan 28, 2015, 2:25:34 PM1/28/15
to realtime-...@googlegroups.com, loto...@yahoo.ro
I am reciving this : c.XRTMLError {name: "TemplateError", message: "An error occured when trying to apply bindings to a template. The cause is: jQuery is not defined", type: "TemplateError", target: i, info: Object}

João Parreira

unread,
Jan 28, 2015, 2:31:19 PM1/28/15
to realtime-...@googlegroups.com
Did you perform a json stringify before you send the message from PHP?
This is required because of the " (quotes) characters in the message (need escaping).



From: "lotostats via Realtime Framework" <realtime-...@googlegroups.com>
To: realtime-...@googlegroups.com
--
Message has been deleted
Message has been deleted

loto...@yahoo.ro

unread,
Jan 28, 2015, 2:51:50 PM1/28/15
to realtime-...@googlegroups.com, loto...@yahoo.ro
Yes i did ! 

Here is a print screen with my error :


Thank you.

João Parreira

unread,
Jan 28, 2015, 3:11:46 PM1/28/15
to realtime-...@googlegroups.com
Hmmm, this is strange. I'll have to investigate further. I'll get back to you ASAP.



From: "lotostats via Realtime Framework" <realtime-...@googlegroups.com>
To: realtime-...@googlegroups.com
Cc: loto...@yahoo.ro
Sent: Quarta-feira, 28 de Janeiro de 2015 19:51:50
Subject: [Realtime Framework] Re: Toast message with PHP

--

loto...@yahoo.ro

unread,
Jan 28, 2015, 3:46:44 PM1/28/15
to realtime-...@googlegroups.com, loto...@yahoo.ro
On my page where i recive toast message i have this :

 xRTML.TagManager.create({
                name: "Toast",
                id:"t01",
                triggers: ["myTrigger"],
                positionAt: "topright",
                target: "notification",
                effects: [
                    {
                        id: xRTML.Common.Util.idGenerator(),
                        name: "animate",
                        properties: '{"opacity": 0 }',
                        options: '{"duration":0}'
                    }, {
                        id: xRTML.Common.Util.idGenerator(),
                        name: "animate",
                        properties: '{"opacity": 1 }',
                        options: '{"duration":700}'
                    }
                ]
            });

If i remove effects everything works fine.

al...@renfos.com

unread,
Jan 29, 2018, 12:21:32 AM1/29/18
to Realtime Framework
I don't want to send toast message. I want to display toast message in my html page. Can you send the code for me pls.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages