Skip to content

Commit aa2c253

Browse files
committed
Few words on protocol
1 parent 19d8186 commit aa2c253

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,27 @@ And a simplistic example:
7171
For a full-featured example see the
7272
[/examples/sockjs](https://github.com/sockjs/websocket-multiplex/tree/master/examples/sockjs)
7373
directory.
74+
75+
76+
Protocol
77+
--------
78+
79+
The underlying protocol is quite simple. Each message consists of
80+
three comma separated parts: _type_, _topic_ and _payload_. There are
81+
three valid message types:
82+
83+
* `sub` - expresses a will to subscribe to a given _topic_.
84+
* `msg` - a message with _payload_ is being sent on a _topic_.
85+
* `uns` - a will to unsubscribe from a _topic_.
86+
87+
Invalid messages like wrong unsubscriptions or publishes to a _topic_
88+
to which a client was not subscribed to are simply ignored.
89+
90+
This protocol assumes that both parties are genrally willing to
91+
copperate and no party can express any kind of errors. All invalid
92+
messages should be ignored.
93+
94+
It's important to notice that the namespace is shared between both
95+
parties and it is not a good idea to use the same topic names on the
96+
client and on the server side. Both parties may express a will to
97+
unsubscribe itself or other party from a topic.

0 commit comments

Comments
 (0)