|
@@ -1,6 +1,6 @@
|
1
|
|
-# PyWSClock
|
|
1
|
+# pyws_clock
|
2
|
2
|
|
3
|
|
-Websocket clock server, handling timezones and alarms.
|
|
3
|
+Websocket clock server, handling timezones, alarms and sessions.
|
4
|
4
|
|
5
|
5
|
## Dependencies
|
6
|
6
|
|
|
@@ -86,3 +86,52 @@ systemctl status pyws_clock.service
|
86
|
86
|
|
87
|
87
|
A sample configuration is available in `nginx_server.conf`.
|
88
|
88
|
|
|
89
|
+## Websocket server protocol description
|
|
90
|
+
|
|
91
|
+The server replies on any URL.
|
|
92
|
+
|
|
93
|
+Before entering the main loop, the listening server waits for 1st message
|
|
94
|
+containing a session ID. If an empty/dummy/invalid/unknown session ID is sent by the
|
|
95
|
+client, the server replies with a new, valid, session ID and enter the main loop.
|
|
96
|
+If a valid session ID is sent, the server reply the same session ID and enter
|
|
97
|
+the main loop, formated using `SESSION:<SESSION_ID>`.
|
|
98
|
+
|
|
99
|
+### Main loop
|
|
100
|
+
|
|
101
|
+The server send the current time (ISO 8601 format) every second.
|
|
102
|
+
|
|
103
|
+### Command results
|
|
104
|
+
|
|
105
|
+The client can interact with the server sending one of the command listed using
|
|
106
|
+`python3 -m pyws_clock -L`.
|
|
107
|
+
|
|
108
|
+When a client send a command, the next message from the server will be a command
|
|
109
|
+result. Results are string formatted using `<STATUS>:<DETAILS>.` Status can be
|
|
110
|
+one of `'ERR'` or `'OK'`, details are optionnale for OK statuses.
|
|
111
|
+
|
|
112
|
+### Alarms rings
|
|
113
|
+
|
|
114
|
+When an alarm is ringing, after sending time, the server send messages formatted
|
|
115
|
+using `ALRM:<NAME>` where `NAME `is the name of the ringing alarm.
|
|
116
|
+If multiple alarms are ringing, multiple `ALRM:` messages are sent every second.
|
|
117
|
+
|
|
118
|
+### Timezone informations
|
|
119
|
+
|
|
120
|
+Before the first time is sent and every time the timezone changes (inclucing
|
|
121
|
+summer/winter transitions), the clock. Timezones messages are formatted using
|
|
122
|
+`TZN:<TZNAME>`
|
|
123
|
+
|
|
124
|
+### Messages types summary
|
|
125
|
+
|
|
126
|
+* Session ID
|
|
127
|
+ * `SESSION:<SESSION_ID>`
|
|
128
|
+* Clock tick
|
|
129
|
+ * `ISO8601_Datetime`
|
|
130
|
+* Timezone name
|
|
131
|
+ * `TZN:<TZNAME>`
|
|
132
|
+* Alarm rings
|
|
133
|
+ * `ALRM:<JSON_ARRAY>`
|
|
134
|
+* Command results
|
|
135
|
+ * `OK:<DETAILS>`
|
|
136
|
+ * `ERR:<REASON>`
|
|
137
|
+
|