I have read THIS tutorial about creating Push nodes and posting/subscribing to notifications.
The only problem I have met is that it seems that notificationconf
unable to create that node...
My first question: are nodename (parameter of notificationconf
tool) and notificationName
(NSString
which I use from app) the same things?
Second:
notificationconf createnode push.example.com BFMyTestPushhNotification beefon
Enter password: // password from Open Directory for user beefon - it is Admin of the 10.6 server
2010-01-24 13:24:58.916 notificationconf[15221:903] created XMPP session
2010-01-24 13:24:58.931 notificationconf[15221:903] Connecting to push.example.com:5222 w开发者_如何转开发ith user com.apple.notificationuser@push.example.com/TestPubsub, security = 2 ...
2010-01-24 13:24:59.130 notificationconf[15221:903] sessionCallback (event 1)
2010-01-24 13:24:59.130 notificationconf[15221:903] Session stopped (event 1)
What I do wrong? And posting notification from app does nothing...
Thanks for any help!
I've been trying to use Snow Leopard Server's Push Notification service with a custom application based on XMPP Publish–Subscribe. I struggled to create a node but finally figured it out.
Track down the password for the service account
com.apple.notificationuser
. You can find it, for example, in/private/etc/dovecot/notify/notify.plist
.Connect to your push notification server with JID
com.apple.notificationuser@your-chat-server-hostname.com
and that password.Create nodes the normal way. In XMPPFramework it's like this:
XMPPJID *serviceJID = [XMPPJID jidWithString:@"pubsub.your-chat-server-hostname.com"]; XMPPPubSub *xmppPubSub = [[XMPPPubSub alloc] initWithServiceJID:serviceJID]; [xmppPubSub createNode:@"pubsub.your-chat-server-hostname.com` withOptions:nil];
The server creates the node. It responds with an iq, but not the one the spec requires. It does send a compliant error if the node already exists.
<iq xmlns="jabber:client" to="com.apple.notificationuser@your-chat-server-hostname.com/..." from="pubsub.your-chat-server-hostname.com" id="...:create_node" type="result"/>
Connect using that same user to publish your updates.
I was never able to get notificationconf
to work.
Notifications are easy to use on the same node, but harder across a network. Especially, I don't think too many people are actually using it, as Google search results are scarce :) Now, regarding your questions:
For 1: yes, you need to have matching nodename
and notificationName
. The man page says so (although not crystal-clear):
createnode hostname nodename username
Creates a node on the server to send notifications using. Before
a client can subscribe to notifications with a given name, the
server must be configured with a node with a matching name.
So, first you have to create the node, then you can listen to notifications of a given name. Otherwise, you don't get the notifications.
For 2: I get this error when there is no XMMP daemon running (i.e. port 5222 is closed). Is that port open for you? (check the output of nmap -p 5222 push.example.com
).
精彩评论