Skip to content
santosh79 edited this page Mar 18, 2012 · 5 revisions

Protocol

Traffic Cop uses a binary protocol for exchanging messages. I've tried to keep the protocol simple and obvious, so if you'd like to write a client in the language of your choice, it should be straightforward. There are two kinds of messages:

Publish Messages

That are sent from the client to the server, contain information on what channel to publish the data on and the actual data itself. They have the format:

Traffic Cop Packet Info

Subscribe Messages

That are sent from the client to the server, contain information on the channels the client would like to subscribe to. This is a comma seperated list of channels, so having a channel name with a comma in it, is not going to work. They have the format:

Traffic Cop Packet Info

Just to be clear, the server is able to distinguish publish and subscribe messages from each other by looking at the message type (the 2nd header), which is 1 for publish message and 2 for subscribe messages.

Messages from the server

Clients that have subscribed to channels, will get messages from the server whenever someone publishes a message on that same channel. These messages have the format:

Traffic Cop Packet Info

Clone this wiki locally