Bayeux 协议学习



官方文档

名词解释
BC: bayeux 客户端
U: User Agen
P: proxy 代理
O: 普通的HTTP SERVER
BS: bayeux 服务


客户端到服务的的事件传播
引用

BC ---------- U ---------- P ------------ O ---------- BS
| --M0(E)--> |                      |                        |                     |     //消息(事件)
|                    | ---HTTP request(M0(E))-->     |                     |
|                    |                      |                        | --M0(E)-->  |
|                    |                      |                        | <---M1---- |    //服务端响应
|                    | <---HTTP response(M1)----   |                     |
| <---M1---  |                      |              |            |
|                    |                      |              |            |


服务端到客户端的事件传播
引用

BC ---------- U ---------- P ------------ O ---------- BS
| ---M0--->  |            |              |            |                   //联接服务
|            | --- HTTP request(M0) ---> |            |
|            |            |              | ----M0---> |
~            ~            ~              ~            ~ wait            //等待
|            |            |              | <--M1(E)-- |              //事件
|            | <--HTTP response(M1(E))-- |            |     //响应
| <--M1(E)-- |            |              |            |
~            ~            ~              ~            ~            


循环联接:
客户端连接到服务端后,一直阻塞等待服务端的响应,收到响应后,断开本次连接,然后重新联接服务端继续等待
引用

BC ---------- U ---------- P ------------ O ---------- BS
| ---M0--->  |            |              |            |              //连接服务
|            | --- HTTP request(M0) ---> |            |        
|            |            |              | ----M0---> |
~            ~            ~              ~            ~ wait
|            |            |              | <--M1(E)-- |               //触发事件
|            | <--HTTP response(M1(E))-- |            |    //响应
| <--M1(E)-- |            |              |            |           
| ---M2--->  |            |              |            |              //重新连接
|            | --- HTTP request(M2) ---> |            |
|            |            |              | ----M2---> |
~            ~            ~              ~            ~ wait


流式连接:
和上面的基本相同只是收到响应后不断开连接,一直保持连接状态
引用

BC ---------- U ---------- P ------------ O ---------- BS
| ---M0--->  |            |              |            |
|            | --- HTTP request(M0) ---> |            |
|            |            |              | ----M0---> |
~            ~            ~              ~            ~ wait
|            |            |              | <--M1(E0)- |
|            | <--HTTP response(M1(E0))- |            |
| <--M1(E0)- |            |              |            |
~            ~            ~              ~            ~ wait
|            |            |              | <--M1(E1)- |
|            | <----(M1(E1))------------ |            |
| <--M1(E1)- |            |              |            |
~            ~            ~              ~            ~ wait


双连接:
将请求分2个HTTP连接,这样就可以异步处理。 req1的响应可能在req0之前
引用

BC ---------- U ---------- P ------------ O ---------- BS
| ---M0--->  |            |              |            |
|            | ------ req0(M0) --------> |            |
|            |            |              | ----M0---> |
~            ~            ~              ~            ~ wait
| --M1(E1)-> |            |              |            |
|            | ----- req1(M1(E1))------> |            |
|            |            |              | --M1(E1)-> |
|            |            |              | <---M2---- |
|            | <---- resp1(M2)---------- |            |
| <---M2---  |            |              |            |
~            ~            ~              ~            ~ wait
|            |            |              | <-M3(E2)-- |
|            | <-----resp2(M3(E2))------ |            |
| <-M3(E2)-- |            |              |            |
| ---M4--->  |            |              |            |
|            | ------req3(M4)----------> |            |
|            |            |              | ----M4---> |
~            ~            ~              ~            ~ wait

你可能感兴趣的:(jquery,SVN,weblogic,dojo,Glassfish)