Cognition of the agsXMPP

1 篇文章 0 订阅

What the XMPP protocol depict ,In fact, it is totally the exchange of the XML datas between the client and server.  Using the object-oriented thinking to describe the XML fragments as Jabber packets is the common way.  I had read some open source projects about jabber both in C# and Java,  The designers think in the same way. So is the structure. They just like carving  from the same template.

When the Socket receives data from the sender,  it all pushes to the StreamParser.  Then,StreamParser parses the  data。The method of parsing uses the mind of compiler construction principles,describing the keywords as the enumeration of the tokens. I think it will be faster than comparing strings.

As the process of parsing,  the StreamParser will trigger the following four events.

1.streamParser_OnStreamStart
2.streamParser_OnStreamEnd
3.streamParser_OnStreamElement
4.streamParser_OnStreamError

When receiving "
SEND: <stream:stream to=’capulet.com’xmlns=’jabber:client’
               xmlns:stream=’http://etherx.jabber.org/streams’> ",  StreamParser will trigger the streamParser_OnStreamStart evnet.  In responding the event we (the server) need the user to authenticate or register. 
1.authentication:
If the client want to login in at the moment, it should request the server for login-in information. 
The side of client may do as follows:
RequestLoginInfo()         asking for imformation of login-in from the server
OnGetAuthInfo()                when receiving the information, it will prepare to send the request.
OnAuthenticate()               As the response from the server , it autheticate the user whether is the member of  the server. If yes, then
RequestAgents() and RequestRoster()          ( the function is easy to kown it's meaning.)
To be continue....
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值