Skip to content

Latest commit

 

History

History
186 lines (130 loc) · 4.24 KB

protocol.rst

File metadata and controls

186 lines (130 loc) · 4.24 KB

Protocol v1

pseud uses to transport its messages ØMQ with ROUTER sockets. the structure of every frames follow this specification.

ENVELOPE + PSEUD MESSAGE

ENVELOPE

The envelope belongs to ømq typology to route messages to right recipient. the are separated from pseud message with empty delimiter ''. Basically the envelope will be :

['peer_identity', '']

PSEUD MESSAGE

FRAME 0: VERSION of current protocol :

utf-8 string 'v1'

FRAME 1: message uuid :

bytes uuid4 or empty string for hearbeat messages

FRAME 2: message type :

byte

FRAME 3: body :

WORK, OK, ERROR and HELLO expect msgpack.
AUTHENTICATED, UNAUTHORIZED and HEARTBEAT expect utf-8 strings.

MESSAGE TYPES

WORK

'\x03'
the body content is a tuple of 3 items
  1. dotted name of the rpc-callable
  2. tuple of positional arguments
  3. dict of keyword arguments

OK

'\x01'

ERROR

'\x10'
the body content is a tuple of 3 items
  1. string of Exception class name e.g. 'AttributeError'
  2. message of the exception
  3. Remote traceback

UNAUTHORIZED

'\x11'

HELLO

'\x02'
the body content is a tuple of 2 items
  1. login
  2. password

AUTHENTICATED

'\x04'

HEARTBEAT

'\x06'

COMMUNICATION

  1. client sends work to server and receive successful answer.

    client

    ->

    <- server
    WORK
    OK
  2. client sends work to server and receive an error.

    client

    ->

    <-

    server
    WORK
    ERROR
  3. server sends work to client and receive successful answer.

    client

    ->

    <- server
    WORK
    OK
  4. client sends an heartbeat

    client

    ->

    <-

    server
    HEARTBEAT
  5. server sends an heartbeat

    client

    ->

    <-

    server

    HEARTBEAT

  6. client send a job and server requires authentication

    client

    ->

    <-

    server
    WORK

    UNAUTHORIZED

    HELLO

    AUTHENTICATED

    WORK

    OK

  7. client send a job and server requires authentication but fails

    client

    ->

    <-

    server
    WORK

    UNAUTHORIZED

    HELLO

    UNAUTHORIZED