4.8.3 Server Protocol

You can see the session server in action by using telnet.

djc@rat:~$ telnet localhost 34343 
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
new myapp 3600
OK 38b80b3f546c8cfa
put myapp 38b80b3f546c8cfa
OK - send data now, terminate with blank line
here is my session data
it is on multiple lines

OK
get myapp 38b80b3f546c8cfa
OK - session follows
here is my session data
it is on multiple lines

del myapp 38b80b3f546c8cfa
OK
get myapp 38b80b3f546c8cfa
ERROR no such session
quit
Connection closed by foreign host.
djc@rat:~$

All dialogue is line based using a CRLF end of line sequence. Session ids are generated by the server and each application has its own set of session ids. The application mixin class in the albatross.session module uses the session_appid argument to the constructor as the application id with the session server. Note that this application id is also used in the cookie sent to the browser.

If a command was successful the server response line will start with the text 'OK' otherwise it will start with 'ERROR'.



Subsections