ejabberd
安裝與建議一步步最新ejabberd和使用像[email protected]
設置主機名像jyhu
。我如何設置與ejabberd我的XMPP服務器的iOSxmpp
我從github上下載了最新的XMPPFramework。iOS
安裝項目fowllowing:init xmppStream
self.xmppStream = [[XMPPStream alloc] init]; [self.xmppStream addDelegate:self delegateQueue:dispatch_get_main_queue()]; [self.xmppStream setHostName:@"127.0.0.1"]; [self.xmppStream setHostPort:5280];
setup JID
[self.xmppStream setMyJID:[XMPPJID jidWithString:self.userName]];
connect
if (![self.xmppStream connectWithTimeout:XMPPStreamTimeoutNone error:&error]) { NSLog(@"%@", [error userInfo]); }
然後設置一些相關型號的委託方法。
當我跑我的項目,像所示
2015年8月28日10 ejabberd日誌:45:29.890 [信息] < 0.436.0> @ejabberd_listener:接受:299(#Port < 0.3800 >)接受連接127.0.0.1:62419 - > 127.0.0.1:5280 2015-08-28 10:45:29.890 [info] < 0.442.0> @ejabberd_http:init:157啓動:{gen_tcp,#端口< 0.3800 >}
而代表將會去:
- (void)xmppStreamWillConnect:(XMPPStream *)sender
- (void)xmppStream:(XMPPStream *)sender socketDidConnect:(GCDAsyncSocket *)socket
- (void)xmppStreamDidStartNegotiation:(XMPPStream *)sender
- (void)xmppStreamDidDisconnect:(XMPPStream *)sender withError:(NSError *)error
但最重要的方法
- (void)xmppStreamDidConnect:(XMPPStream *)sender
將永遠不會執行。