Updated Protocol draft 2.0 (markdown)
parent
98ff054a42
commit
fe01e43ba1
1 changed files with 17 additions and 16 deletions
|
@ -1,10 +1,11 @@
|
|||
|
||||
The 2.0 specification is quite different from the old one. This one is based on a stable and mature protocol; HTTP. We will borrow certain elements from the protocol, with main focus on HTTP's POST style. Here is a link: http://www.jmarshall.com/easy/http/#http1.1c1 Below is a typical POST message in HTTP.
|
||||
|
||||
<pre>POST /path/script.cgi HTTP/1.0
|
||||
From: frog@jmarshall.com
|
||||
User-Agent: HTTPTool/1.0
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Content-Length: 32
|
||||
Content-Encoding: application/x-www-form-urlencoded
|
||||
Content-Size: 32
|
||||
|
||||
home=Cosby&favorite+flavor=flies</pre>
|
||||
|
||||
|
@ -16,10 +17,10 @@ Accept: plaintext</pre>
|
|||
|
||||
You will get an answer with your own client token:
|
||||
|
||||
<pre>Server-Command: token
|
||||
Content-Type: plaintext
|
||||
Content-Length: 45
|
||||
Server-Version: 1.0
|
||||
<pre>Client-Command: welcome
|
||||
Content-Encoding: plaintext
|
||||
Content-Size: 45
|
||||
GGS-Version: 1.0
|
||||
Accept: gzip,plaintext
|
||||
|
||||
913AB7FD-F795-45E4-B31C-035FD81D0773</pre>
|
||||
|
@ -28,8 +29,9 @@ Then you will define your game, that means, you send the source code of your gam
|
|||
|
||||
<pre>Token: 913AB7FD-F795-45E4-B31C-035FD81D0773
|
||||
Server-Command: define
|
||||
Content-Type: text
|
||||
Content-Length: 666
|
||||
Content-Encoding: plaintext
|
||||
Content-Type: javascript
|
||||
Content-Size: 666
|
||||
|
||||
function userCommand(user, cmd, args) {
|
||||
if(cmd == "moveUp") {
|
||||
|
@ -67,8 +69,8 @@ Now you can call commands in that game:
|
|||
|
||||
<pre>Token: 913AB7FD-F795-45E4-B31C-035FD81D0773
|
||||
Command: moveUp
|
||||
Content-Type: text
|
||||
Content-Length: 40
|
||||
Content-Encoding: plaintext
|
||||
Content-Size: 1
|
||||
|
||||
5</pre>
|
||||
|
||||
|
@ -76,8 +78,8 @@ or:
|
|||
|
||||
<pre>Token: 913AB7FD-F795-45E4-B31C-035FD81D0773
|
||||
Command: chat
|
||||
Content-Type: text
|
||||
Content-Length: 90
|
||||
Content-Encoding: plaintext
|
||||
Content-Size: 90
|
||||
|
||||
Hi guys,
|
||||
|
||||
|
@ -102,10 +104,9 @@ Accept: plaintext</pre>
|
|||
|
||||
You will get as an answer just the game session token:
|
||||
|
||||
<pre>Server-Command: game-session-token
|
||||
Content-Type: plaintext
|
||||
Content-Length: 45
|
||||
Server-Version: 1.0
|
||||
<pre>Client-Command: game-session-token
|
||||
Content-Encoding: plaintext
|
||||
Content-Size: 45
|
||||
Accept: gzip,plaintext
|
||||
|
||||
018FF079-B383-4523-93A2-6053E7EDC2BC</pre>
|
||||
|
|
Reference in a new issue