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.
|
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
|
<pre>POST /path/script.cgi HTTP/1.0
|
||||||
From: frog@jmarshall.com
|
From: frog@jmarshall.com
|
||||||
User-Agent: HTTPTool/1.0
|
User-Agent: HTTPTool/1.0
|
||||||
Content-Type: application/x-www-form-urlencoded
|
Content-Encoding: application/x-www-form-urlencoded
|
||||||
Content-Length: 32
|
Content-Size: 32
|
||||||
|
|
||||||
home=Cosby&favorite+flavor=flies</pre>
|
home=Cosby&favorite+flavor=flies</pre>
|
||||||
|
|
||||||
|
@ -16,10 +17,10 @@ Accept: plaintext</pre>
|
||||||
|
|
||||||
You will get an answer with your own client token:
|
You will get an answer with your own client token:
|
||||||
|
|
||||||
<pre>Server-Command: token
|
<pre>Client-Command: welcome
|
||||||
Content-Type: plaintext
|
Content-Encoding: plaintext
|
||||||
Content-Length: 45
|
Content-Size: 45
|
||||||
Server-Version: 1.0
|
GGS-Version: 1.0
|
||||||
Accept: gzip,plaintext
|
Accept: gzip,plaintext
|
||||||
|
|
||||||
913AB7FD-F795-45E4-B31C-035FD81D0773</pre>
|
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
|
<pre>Token: 913AB7FD-F795-45E4-B31C-035FD81D0773
|
||||||
Server-Command: define
|
Server-Command: define
|
||||||
Content-Type: text
|
Content-Encoding: plaintext
|
||||||
Content-Length: 666
|
Content-Type: javascript
|
||||||
|
Content-Size: 666
|
||||||
|
|
||||||
function userCommand(user, cmd, args) {
|
function userCommand(user, cmd, args) {
|
||||||
if(cmd == "moveUp") {
|
if(cmd == "moveUp") {
|
||||||
|
@ -67,8 +69,8 @@ Now you can call commands in that game:
|
||||||
|
|
||||||
<pre>Token: 913AB7FD-F795-45E4-B31C-035FD81D0773
|
<pre>Token: 913AB7FD-F795-45E4-B31C-035FD81D0773
|
||||||
Command: moveUp
|
Command: moveUp
|
||||||
Content-Type: text
|
Content-Encoding: plaintext
|
||||||
Content-Length: 40
|
Content-Size: 1
|
||||||
|
|
||||||
5</pre>
|
5</pre>
|
||||||
|
|
||||||
|
@ -76,8 +78,8 @@ or:
|
||||||
|
|
||||||
<pre>Token: 913AB7FD-F795-45E4-B31C-035FD81D0773
|
<pre>Token: 913AB7FD-F795-45E4-B31C-035FD81D0773
|
||||||
Command: chat
|
Command: chat
|
||||||
Content-Type: text
|
Content-Encoding: plaintext
|
||||||
Content-Length: 90
|
Content-Size: 90
|
||||||
|
|
||||||
Hi guys,
|
Hi guys,
|
||||||
|
|
||||||
|
@ -102,10 +104,9 @@ Accept: plaintext</pre>
|
||||||
|
|
||||||
You will get as an answer just the game session token:
|
You will get as an answer just the game session token:
|
||||||
|
|
||||||
<pre>Server-Command: game-session-token
|
<pre>Client-Command: game-session-token
|
||||||
Content-Type: plaintext
|
Content-Encoding: plaintext
|
||||||
Content-Length: 45
|
Content-Size: 45
|
||||||
Server-Version: 1.0
|
|
||||||
Accept: gzip,plaintext
|
Accept: gzip,plaintext
|
||||||
|
|
||||||
018FF079-B383-4523-93A2-6053E7EDC2BC</pre>
|
018FF079-B383-4523-93A2-6053E7EDC2BC</pre>
|
||||||
|
|
Reference in a new issue