Hi,
First thing first, are you sure the "author" var is defined before you send it?
Try this to see if the author is defined in the function scope
requestMsg: function (pipe, options) {
alert(author);
myPipe.request.send('SEND', {'author':author, 'msg':'<span
style="color:#' + SNColorCur + '">' + sn + ': </span>' + ' ' + message});
},
To share the author name for the chat, you can also make use of the user
property and raw.data.from in the onRaw if you set the author name in user
properties (like the name is set at "start" in some demos).
Envoyé de mon iPad
> Le 2014-05-17 à 16:52, michael <[email protected]> a écrit :
>
> Hello, I am creating a chat and am having problems sending multiple values
> and receiving them on an onRaw event. I am trying to send the author and the
> msg to the users but raw.data.author is comming up as undefined while
> raw.data.msg is defined. when i put this.onRaw('data') it works but
> this.onRaw('SEND') does not.
> this is inside the intialize function :
>
> this.onRaw('data', this.rawSendMsg);
> this.addEvent('load', this.startCore);// load ape core
> this.addEvent('ready', this.joinChannel);// once the ape core is
> loaded connect to pipe/channel
> this.addEvent('uniPipeCreate', this.channelJoined);
> this.addEvent('multiPipeCreate', function(pipe) {// once the channel
> is successfully joined
> myPipe = pipe;
> this.channelJoined();
> });
>
>
> requestMsg: function (pipe, options) {
> myPipe.request.send('SEND', {'author':author, 'msg':'<span
> style="color:#' + SNColorCur + '">' + sn + ': </span>' + ' ' + message});
> },
> rawSendMsg: function (raw, pipe) {
> this.sendMsg(pipe, raw.data.author, raw.data.msg);
> },
> parseMessage: function(message){
> return decodeURIComponent(message);// escape and return raw data for
> use in sendMsg
> },
> sendMsg: function (pipe, from, message) { // function used to send
> decoded message through rawDataEscape
> $('.chatBoxmsginCon').append( // once rawDataEscape receives it, the
> message will be sent to chat
> new Element('p', {'author':this.parseMessage(from),
> 'class':'newMessage', html:this.parseMessage(message)}));
> $('.newMessage:last-of-type').hide().fadeIn(300);
> $('input[class=Chatmsg]').val("");
> this.scrollBot;// scroll chat to bottom for new
> message
> }
> --
> --
> You received this message because you are subscribed to the Google
> Groups "APE Project" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/ape-project?hl=en
> ---
> APE Project (Ajax Push Engine)
> Official website : http://www.ape-project.org/
> Git Hub : http://github.com/APE-Project/
>
> ---
> You received this message because you are subscribed to the Google Groups
> "APE Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
--
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/
---
You received this message because you are subscribed to the Google Groups "APE
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.