I included "/ape/Clients/mootools-core.js", "/ape/Clients/JavaScript.js" and "/ape/config.js". I use Jquery instead of Mootool, but somehow "mootools-core" is needed for Ape to work. Maybe someone else could give more info about this as I not sure why I need both Mootools and Javascript.js, except the fact that it works.
The config should look like this: APE.Config.baseUrl = 'http://battlefieldnations.com'; //APE JSF APE.Config.domain = 'battlefieldnations.com'; APE.Config.server = 'battlefieldnations.com:6969'; //APE server URL OR APE.Config.baseUrl = 'http://shout.battlefieldnations.com'; //APE JSF APE.Config.domain = 'battlefieldnations.com'; APE.Config.server = 'shout.battlefieldnations.com:6969'; //APE server URL You tested your setup with the "check" tool? The "0" in "Ape.Config.Server" URL seems wrong. Le 2011-11-28 à 06:24, Rossco a écrit : > Some information about my setup. > > I have a subdomain setup with a wildcard. > *shout.battlefieldnations.com > > My config is as follows, > > APE.Config.baseUrl = 'http://shout.battlefieldnations.com'; //APE JSF > APE.Config.domain = 'battlefieldnations.com'; > APE.Config.server = '0.shout.battlefieldnations.com:6969'; //APE > server URL > > On Nov 28, 10:22 am, Rossco <[email protected]> wrote: >> Hello, >> >> I'm trying to understand how you've managed to do this. Being new to >> APE it's quite difficult to understand. >> >> Which Javascript files do I need to include in the head of my page? >> Just the mootools-core, mootools and config? >> >> I'm having some difficulty with APE but I'm hoping I can achieve what >> I need! >> >> Thanks >> >> On Nov 26, 10:55 pm, Louis Charette <[email protected]> wrote: >> >> >> >> >> >> >> >>> I didn't use the session restore thing, but it looks ok. >> >>> I may suggests that you use the "user.setProperty" server side command to >>> assign info to a user, even the username. >>> Seehttp://www.ape-project.org/docs/server/users/user.setproperty.htmlfordetails. >>> When you specify the username in the "core.start", you're limited >>> regarding certain character or the length of the username. >> >>> Here's a example of my code if you need it: >> >>>> chat = new APE.Chat(); >> >>>> //Load APE >>>> chat.load({ >>>> identifier: 'SC_Chat', >>>> channel: 'listeSalon' >>>> }); >> >>>> //Once Ape is ready, connect to server >>>> chat.addEvent('load', function(core){ >>>> chat.core.start({ >>>> 'name': $time().toString(), >>>> }); >>>> }); >> >>>> chat.addEvent('multiPipeCreate', function(pipe, options){ >> >>>> //If we just joined the "lobby" channel... >>>> if (pipe.name == "listesalon") { >> >>>> //Get the info from PHP. PHP will send them to the server with >>>> InlinePush >>>> $.ajax({ >>>> type: "POST", >>>> url: baseUrl+'chat', >>>> dataType: "html", >>>> data: >>>> "action=serverAuth&firstinit=1&upid="+this.core.user.pubid, >>>> success: function(data) { >>>> //Ready to chat >>>> // [...] >>>> } >>>> }); >>>> } >>>> }); >> >>> The AJAX request send info to Ape with InlinePush kind of request. Those >>> informations (Username, pics, etc) are store in the user public property >>> like described earlier. With this, I don't need to ask for the username and >>> pic when he send a message in the chat. >> >>> When a user post something on the chat, it's actually send with php >>> inlinepush since I don't have MySQL support on the server itself (and I >>> need to parse BBcode with php). Here is the code from PHP and the Ape >>> Server-side command >> >>>> //On prépare la transmission à APE >>>> $cmd = array(array( >>>> 'cmd' => 'chatsendmsg', >>>> 'params' => array( >>>> 'password' => $chat->APE_PASSWORD, >>>> 'raw' => 'chatSendMsg', >>>> 'channel' => $_POST['pipename'], //The >>>> current channel name >>>> 'data' => array( >>>> 'chatmsg' => $msg, >>>> 'userid' => >>>> $user->data['user_id'], >>>> 'pubid' => >>>> $_POST['upid'], >>>> ), >>>> ) >>>> )); >> >>>> //On transmet à APE >>>> $data = file_get_contents($chat->APE_SERVER . >>>> urlencode(json_encode($cmd))); >>>> Ape.registerCmd("chatsendmsg", false, function(params, infos) { >>>> if (params.password == Ape.config("inlinepush.conf", "password")) { >> >>>> if ($defined(params.channel) && $defined(params.data) && >>>> $defined(params.raw)) { >>>> var chan = Ape.getChannelByName(params.channel); >>>> if (!$defined(chan)) return ["401", "UNKNOWN_CHANNEL"]; >> >>>> //Get Ape user Info from PubID >>>> var thisUser = Ape.getUserByPubid(params.data.pubid); >> >>>> //validate the phpBB ID match for security >>>> if (params.data.userid != >>>> thisUser.getProperty('userid')) { >>>> return ["092", "BAD_PHP_USERID"]; >>>> } >> >>>> //Send data to the channel >>>> chan.pipe.sendRaw("chatSendMsg", { >>>> "chatmsg": params.data.chatmsg, >>>> "username": thisUser.getProperty('username'), >>>> "avatar": thisUser.getProperty('avatar'), >>>> "userid": thisUser.getProperty('userid'), >>>> "pipename": chan.getProperty('name'), >>>> }); >> >>>> //Tout est ok >>>> return {"name":"pushed","data":{"value":"ok"}}; >>>> } else { >>>> return 0; >>>> } >>>> } else { >>>> return ["400", "BAD_PASSWORD"]; >>>> } >> >>>> }); >> >>> As you can see, you need to know the user Public ID. To send to only one >>> person, it's the same thing, but you need to know both user pubid or you >>> can create a temporary channel that both user need to join. For the first >>> method, you change "chan.pipe.sendRaw" with: >> >>>> var toUser = Ape.getUserByPubid(params.data.to_user_pubid); >>>> toUser.pipe.sendRaw("chatSendMsg", { ... }); >> >>> I don't know if any of this will help get you started, but let me know. >> >>> It can quite complex depending on how you want to do thing. I added a lot >>> of thing in my application because I wanted a complete solution with online >>> status (Away, busy, online), personal message, etc. If you want to add >>> little extra stuff in you app, even history, you'll need to get your hand >>> dirty and use AJAX / PHP InlinePush and/or ServerSide command. But in the >>> hand it's worth it when you see a lot of people using your chat and giving >>> you great feedback on the work you've done. >> >>> - Louis >> >>> Le 2011-11-26 à 10:44, Rossco a écrit : >> >>>> Ok I have edited my script which seems to load up a user id and >>>> name... The [[+smf.username]] is just a placeholder that will pass >>>> the username. Now I guess I need to figure out how to send messages >>>> to the mainLobby channel then take it further to one to one messages. >>>> Does this appear to be correct so far? >> >>>> APE.Config.scripts = [APE.Config.baseUrl + '/Build/ >>>> uncompressed/apeCoreSession.js']; >>>> var client = new APE.Client(); >> >>>> client.load({'identifier': 'shoutit', 'channel':'mainLobby', >>>> 'userid':'1'}); >>>> client.addEvent('load', function() { >>>> //core.options.restore is true if a session is active >>>> if (client.core.options.restore) { >>>> client.core.start(); >>>> } else { >>>> client.core.start({'name':'[[+smf.username]]', >>>> 'userid':'[[+smf.id]]'}); >>>> } >>>> }); >> >>>> client.addEvent('ready', function() { >>>> if (client.core.options.restore) { >>>> client.core.getSession('name', function(name) { >>>> console.log('Receiving sessions data. username >>>> value is : ', name.data.sessions.name); >>>> }); >>>> client.core.getSession('id', function(id) { >>>> console.log('Receiving sessions data. id value >>>> is : ', id.data.sessions.id); >>>> }); >>>> } else { >> >>>> console.log('saving custom session data, username on >>>> the server'); >>>> client.core.setSession({'name':'[[+smf.username]]', >>>> 'id':'[[+smf.id]]'}); >>>> } >>>> }); >> >>>> client.addEvent('multiPipeCreate', function(pipe) { >>>> console.log('New pipe ' + pipe.name); >>>> }); >> >>>> -- >>>> 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/
