?? x524.htm
字號:
<HTML
><HEAD
><TITLE
>Messaging</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
"><LINK
REL="HOME"
TITLE="Programming Jabber"
HREF="book1.htm"><LINK
REL="UP"
TITLE="Inside Jabber"
HREF="c445.htm"><LINK
REL="PREVIOUS"
TITLE="Asynchronous Nature"
HREF="x503.htm"><LINK
REL="NEXT"
TITLE="Payload Carrier"
HREF="x557.htm"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Programming Jabber</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x503.htm"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 2. Inside Jabber</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x557.htm"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="JABTDG-CH-2-SECT-2.3"
>Messaging</A
></H1
><P
>We've been using the term "message" in quite a general sense - to represent
data passing from one Jabber entity to another. In fact, as we'll see in
<A
HREF="c3612.htm"
>Chapter 5</A
>, there are different types, and subtypes, of
message—and each one
has a certain role within the whole context of the Jabber protocol. These
messaging types are sometimes referred to as elements, and there are three
of them -
<TT
CLASS="LITERAL"
><message/></TT
>,
<TT
CLASS="LITERAL"
><iq/></TT
> and
<TT
CLASS="LITERAL"
><presence/></TT
>.
<A
NAME="JABTDG-CH-2-FOOTNOTE-2"
HREF="#FTN.JABTDG-CH-2-FOOTNOTE-2"
>[1]</A
></P
><P
>The <TT
CLASS="LITERAL"
><message/></TT
> element has five subtypes -
<I
CLASS="EMPHASIS"
>normal</I
>, <I
CLASS="EMPHASIS"
>chat</I
>,
<I
CLASS="EMPHASIS"
>groupchat</I
>, <I
CLASS="EMPHASIS"
>headline</I
>, and
<I
CLASS="EMPHASIS"
>error</I
>, for example.
The <TT
CLASS="LITERAL"
><iq/></TT
> and
<TT
CLASS="LITERAL"
><presence/></TT
> elements also have subtypes
to distinguish and describe their usage and context.
(The <TT
CLASS="LITERAL"
><iq/></TT
> element has types
<I
CLASS="EMPHASIS"
>get</I
>, <I
CLASS="EMPHASIS"
>set</I
>,
<I
CLASS="EMPHASIS"
>result</I
>, and <I
CLASS="EMPHASIS"
>error</I
>, while
the <TT
CLASS="LITERAL"
><iq/></TT
> element has types
<I
CLASS="EMPHASIS"
>available</I
> and <I
CLASS="EMPHASIS"
>unavailable</I
>.)
Furthermore, we already know that
these elements can be extended using namespaces. Each type and subtype,
and each of the pre-defined namespaces (those that begin
'<TT
CLASS="LITERAL"
>jabber:</TT
>') have been designed with specific scenarios
in mind.</P
><P
>There's a certain amount of consideration to be given in this respect when
designing our messaging solutions and applications; how should we employ the
basic message types, and do we need to create our own custom extensions
qualified by our own namespaces?</P
><P
>For the most part, the answers to these questions will depend on what
sort of solution needs to be developed; however, it is also important to
consider what support is already available 'off the shelf' in the form of
Jabber clients. This is especially the case if the application is A2P or
P2A. These Jabber clients provide varying levels of features supporting
the different message types and subtypes. For example, WinJab (for Win32
platforms) and Jarl (cross-platform, written in Perl/Tk) both support the
<TT
CLASS="LITERAL"
><message/></TT
> subtype
<I
CLASS="EMPHASIS"
>headline</I
> and can display
URL information, which typically comes attached to the message in a
<TT
CLASS="LITERAL"
>jabber:x:oob</TT
> qualified extension, in a useful way. If
you're writing a news headline alert mechanism, for example, you may want
to consider aiming development with a target of WinJab or Jarl in mind;
the alternative is to develop your custom news headline viewer client.</P
></DIV
><H3
CLASS="FOOTNOTES"
>Notes</H3
><TABLE
BORDER="0"
CLASS="FOOTNOTES"
WIDTH="100%"
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="5%"
><A
NAME="FTN.JABTDG-CH-2-FOOTNOTE-2"
HREF="x524.htm#JABTDG-CH-2-FOOTNOTE-2"
>[1]</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="95%"
><P
>Actually, there are four - but the
fourth—<TT
CLASS="LITERAL"
><route/></TT
>—
is only used by the server, to route messages between the various
components.</P
></TD
></TR
></TABLE
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x503.htm"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.htm"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x557.htm"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Asynchronous Nature</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c445.htm"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Payload Carrier</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -