That's why I never used the sessions :P

  - Louis

Envoyé de mon iPad

Le 2012-06-27 à 23:08, waldo22 <[email protected]> a écrit :

> This is fine... until you refresh the page.
> 
> Then you've already joined the channel (since you're still in the same 
> session), and there is no way that I can tell to access it by pubid or by 
> channel name.
> 
> Please tell me I'm wrong!!!
> 
> -Wes
> 
> On Tuesday, April 12, 2011 1:05:18 PM UTC-4, para wrote:
> No it's called as soon as you join a channel. SO it's valid for everybody ;) 
> "created" means created on the client-side.
> I know it's weird...
> 
> Le 12/04/2011 18:22, ramon mclaren a écrit :
>> 
>> Thanks for the quick answer Anthony,
>> 
>> Here is a question, if the reference to the pipe object is obtained in the 
>> multipipecreate event, will all clients of the website have access to it. My 
>> assumption is that the multipipecreate event is only called once, by the 
>> first person accessing the site... all other clients will not have this 
>> event called and as such will not be given reference to the pipe object for 
>> further use...
>> 
>> Please let me know if my assumption is wrong. The aim is to call the 
>> "pipe.send()" function from a regular javascript function
>> 
>> On Tue, Apr 12, 2011 at 9:40 AM, Anthony Catel <[email protected]> wrote:
>> Hey,
>> 
>> You can juste use "pipe.send()" where pipe is an object returned on the 
>> event "multipipecreate" or by getPipe(pubid).
>> 
>> Le 12/04/2011 06:50, ramonezy a écrit :
>> 
>> Hi all,
>> 
>> I know this might be a simple problem, but I couldn't find what I was
>> looking for in the documentation. I'm trying to create a simple site
>> with two sections, a comment form and a comment stream. The comment
>> form will allow a user to enter a comment and the comment stream will
>> show the comments of all users sorted by time. I wanted to use ape to
>> be able to update the comment stream as soon as a user creates a
>> comment without a page refresh.
>> 
>> The site uses jQuery for a number of functions. I think the main
>> question i have is how to send a message to a multi pipe using a
>> javascript function. I'm not understanding how to get the reference to
>> a pipe if its not done in an event listener.
>> 
>> The flow is upon submit, the ajax form calls its handler, which is
>> postComment. The postComment function will receive a JSON object from
>> my server with the details of the message sent. The JSON object is
>> passed to structureComment, which formats the HTML to be inserted and
>> insertComment inserts the formatted HTML in the comment stream.
>> 
>> My code snippet is below.
>> 
>> Any help would be greatly appreciated
>> 
>> 
>> /
>> *-----------------------------------------------------------------------------------------
>> */
>> 
>> $(document).ready(function() {
>> 
>>         client = new APE.Client();
>>         client.load();
>> 
>>         client.addEvent('load', function() {
>>             client.core.start();
>>         });
>> 
>>         client.addEvent('ready', function() {
>>             client.core.join('testChannel');
>> 
>>             client.onCmd('send', function(pipe, sessid, pubid, msg){
>>                 alert('message send');
>>             });
>> 
>>             client.onRaw('data', function(raw, pipe) {
>>                 var msgHTML = structureComment('msgJSON');
>>                 insertComment(msgHTML);
>>             });
>>         });
>> 
>>        /*-------------------------------------------------*/
>>                 other unrelated javascript code
>>       /*----------------------------------------------------*/
>> 
>>         var msgFormOptions = {
>>             resetForm:  true,
>>             //beforeSubmit: storeCommentDetails,
>>             success:    postComment
>>         };
>> 
>>         $('#commentForm').ajaxForm(msgFormOptions);
>> 
>> });
>> 
>> function postComment(responseText, statusText, xhr, $form){
>> 
>>     if(responseText){
>>         var msgObj = JSON.parse(responseText);
>>         var msgHTML = structureComment(msgObj);
>>         insertComment(msgHTML);
>> 
>>     }else{
>>         alert("Message failed, please try again ");
>>     }
>> }
>> 
>> function insertComment(newCommentHtml){
>>     $('#commentStream').prepend(newCommentHtml);
>> }
>> 
>> function structureComment(msgJSON){
>> 
>>     var nName = msgJSON[0].senderName;
>>     var nCountry = msgJSON[0].senderCountry;
>>     var nMsg = msgJSON[0].senderMsg;
>>     var nDate = 'Today';
>> 
>>     var msgHTML = '<li><div class="comment">' +
>>                   '<div class="commentHeader"><span
>> class="name">'+nName+'</span>  from<span class="country">'+nCountry+'</
>> span>  says:</div>'+
>>                   '<div class="commentBody">'+ nMsg +'</div>' +
>>                   '<div class="commentDate">Time Sent: '+ nDate +'</
>> div>'+
>>                   '<div class="clearDiv"></div></div></li>';
>> 
>>     return msgHTML;
>> }
>> 
>> 
>> -- 
>> 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 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 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 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/

Reply via email to