Writing the Unprotocol

We have all the pieces for a formal protocol specification, and it’s time to put the protocol on paper. There are two reasons for this: first, to make sure that any other implementations talk to each other properly; and second, because I want to get an official port for the UDP discovery protocol, and that means doing the paperwork.

Like all the other unprotocols we’ve developed in this book, the protocol lives on the ØMQ RFC site. The core of the protocol specification is the ABNF grammar for the commands and fields:

zre-protocol = greeting *traffic greeting = S:HELLO traffic = S:WHISPER / S:SHOUT / S:JOIN / S:LEAVE / S:PING R:PING-OK ; Greet a peer so it can connect back to us S:HELLO = header %x01 ipaddress mailbox groups status headers header = signature sequence signature = %xAA %xA1 sequence = 2OCTET ; Incremental sequence number ipaddress = string ; Sender IP address string = size *VCHAR size = OCTET mailbox = 2OCTET ; Sender mailbox port number groups = strings ; List of groups sender is in strings = size *string status = OCTET ; Sender group status sequence headers = dictionary ; Sender header properties dictionary = size *key-value key-value = string ; Formatted as name=value ; Send a message to a peer S:WHISPER = header %x02 content content = FRAME ; Message content as 0MQ frame ; Send a message to a group S:SHOUT = header %x03 group content group = string ; Name of group content = FRAME ; Message content as 0MQ frame ; Join a group S:JOIN = ...

Get ZeroMQ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.