This messaging Service is pretty similar to the ActiveMQ broker from Apache. This one is written in go and is very simple structured and therefore a fast and easy to use messaging service.
This service is based in the so called topics
that are familiar since ActiveMQ used them too.
A topics is just a key on which you can send or receive messages to/from.
CLients can register themself to a topic and is allowed to receive and send message to it.
All topic names are lowercase letters! A registration with some capital letters (e.g. camel-case like "aCoolTopicName") will be changed into lowercase names.
A message is the whole data send by the server or the client.
The data in the message is sometimes also calles message, because it's the most important thing, but is in the goMS
world just the message-data.
The message-data can be everything and of (currently) any size. Normally it would be some XML, JSON or insert-your-favorite-file-format-here data and thats fine.
In the JSON-message (see below) will everything be escaped, but you can send everything you like.
There're different types of messages, namely register
, send
, message
, logout
, close
and error
.
Client → Server
Need the field topics
with a list of topics. A client can only connect to topics, that are configured in the server config.
Client → Server
Needs the fields topics
and data
. The field topics
contains all topics the data goes to. The field data
contains all data that will be send as message to all registered clients.
Server → Client
Only contains the data
field from the send
message.
Client → Server
Needs the field topics
which is a list of all topics the client wants to unregister himself of.
Client → Server
Needs no fields.
Server → Client
Contains the field error-code
which is normally a number (like the HTTP status codes) and the field error
which contains some data belonging to the error (meaning of error codes below).
Here're some information about the server (usage, configuration and internals).
To limit the amount of topics, a client is not able to create one. This is the responsibility of the server administrator. The file /conf/topics.json
contains all available topics.
It's a simple json list like this one:
The following fields need to be specified:
Field | Type | Description |
---|---|---|
topic-config | string | Path to the topics.json file |
connectors | list (s. below) | List of connectors, on which the server is available |
A connector is a specification of a listener, the server is listening on.
Field | Type | Description |
---|---|---|
protocoll | string | The protocoll of the connector. This can be tcp or udp . |
ip | string | The IP address the server is listening on. |
port | number | The port, which is 55545 as default. |
The process of connecting and notifying is described below.
It's very important to do these steps in the given order, otheriwse your request will be ignored. For example: If you send a message to a topic before register yourself to it, your request will be ignored.
55545
)Maybe there'll be an acknowledgement from the server (not implemented yet):
It's also possible (for error-correction) to send the list of topics within the acknowledgement (but as mentioned above: not yet implemented):
Client sends a send
request of the following form to the server:
The server will then look into his map to determine all connections to clients which registeres themselves, and then send the message. The message will have this simple format:
There will be no acknowledgement from the client about the messages. We trust in the TCP protocoll and the client/server implmenetation.
Just send the logout
-message:
The
topics
list is optional, leaving it out will logout the client from all topics.If you want to be kind to the server, you can use the close
-message:
Now some words about the error
message (s. above).
This list of numbers and codes may not be up-to-date and also may change very quickly, so don't wonder about differeces.
To structure the whole thing, each message has its own category.
Error code | Category |
---|---|
000xxx | General Server error |
001xxx | register error |
002xxx | send error |
003xxx | logout error |
004xxx | close error |
Error code | Describtion | The field Error contains ... |
---|---|---|
001001 | Registration not allowed. Maybe the topic doesn't exist in the server config? | ... a list (normal string separated by comma , ) of all topics the client was not able to register to. |
Error code | Describtion | The field Error contains ... |
---|---|---|
002001 | Error sending the message | ... the error message the runtime gives to the server. |
reference
and download
). The files are cahced withing the usrers directory