Hi,
you can access to the user object in all command. For example if you
want to make a user join a channel on connect just do it like that :
Ape.registerHookCmd("connect", function(params, cmd) {
cmd.user.join('testChannel');
return 1;
});
Or in a custom command [1] :
Ape.registerCmd('yourCommand', true, function(params, cmd) {
cmd.user.join('testChannel');
return 1;
});
Or even on some events like adduser [2] :
Ape.addEvent('adduser', function(user) {
user.join('testChannel');
});
- [1] http://www.ape-project.org/docs/server/commands/registercmd.html
- [2] http://www.ape-project.org/docs/server/events/adduser.html
And no you can't create user on the server side.
Regards.
On 17/04/2010 12:26, Stefan Sayer wrote:
Hi,
thanks for the response.
Nicolas Trani wrote:
Hi,
if you want to make a user join a channel use this :
http://www.ape-project.org/docs/server/users/user.join.html
but I can't create a user from SSJS, right? so where do I get the user
from, if I connect from jsonrpc, I can't do
var u = new user();
u.join('mychannel');
At least it gives me an error, and in libape-spidermonkey.c there is
no user class defined, unfortunately.
And IRApeclient.sendCmd is just an IRC client in SSJS, a demo ;)
yeah, right, I understand... just, I haven't found a suitable example
for what I'm trying to do, and the irc client seemed to be the closest
match on the provided examples.
The interim solution I have now is a hook on send command, but that
doesn't seem to me a very good solution.
Thanks
Stefan
Regards.
Stefan Sayer a écrit :
Hello,
I'm writing a json-rpc 2.0/netstrings/tcp server in ape JSJS, and I
would like to write a function with which the client can subscribe
to a channel, and then every time something is posted into that
channel, a notification is sent over the json-rpc connection.
Now, how do I join a channel in JSJS, so that I get a callback when
something is posted into that channel?
I have found the ircserver.js, but there it looks like APE JSJS in
IRCApeclient.sendCmd creates a new connection to itself to port 6969
and posts messages through that connection. Which, I think, is
pretty weird, and can really not be the solution; in the jsjs we are
already in the server code space. Or is this the only method to
interact with a channel from inside APE?
Thanks!
Stefan
--
Nicolas Trani - Web engineer
Weelya - Improve the web
32 rue du faubourg boutonnet
34090 Montpellier
Tel: 04 67 169 778 - Fax: 09 57 91 99 91
http://www.weelya.com
http://www.ape-project.org
--
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/