@@ -6,6 +6,10 @@ _url: [`https://websuck1t.herokuapp.com`](https://websuck1t.herokuapp.com)_
7## GET /posts/all
7## GET /posts/all
9+_start with: [`https://websuck1t.herokuapp.com/posts/all`](https://websuck1t.herokuapp.com/posts/all)_
11+Use this _url_ to get the token every time when application begins and previous session was closed
9### Response:
13### Response:
11- Status code 200
15- Status code 200
@@ -54,12 +58,48 @@ _url: [`https://websuck1t.herokuapp.com`](https://websuck1t.herokuapp.com)_
62+- «token» to further use it in subscription to web socket
58−## GET /users/:id
64+- «response» to start with the given number of posts in table
60−Retrieves a user with the given `id`.
66+## WebSocket /posts/subscribe/:token
68+You access the web socket with the web socket protocol. I. e. `https://` -> `ws://`.
70+Open a web socket from the given `token` for receiving events about new and deleted posts with `ws://websuck1t.herokuapp.com/posts/subscribe/{token}`
72+#### Returns error `498` if the supplied token has expired or is invalid.
76+- *token*: The token, received with the previous request.
100+_url: [`https://websuck1t.herokuapp.com/posts/{id}`](https://websuck1t.herokuapp.com/posts/1)_
62−#### If there is no user with the given `id`, the method returns error `404`.
102+#### If there is no post with the given `id`, the method returns error `404`.
64### Captures:
104### Captures:
@@ -78,11 +118,9 @@ Retrieves a user with the given `id`.
79```javascript
119```javascript
81− "userName": {
121+ «postBody»: «This is the post body»,
82− "secondName": "Leonidovich",
122+ «postAuthor»: 4,
83− "firstName": "Seva"
123+ «postId»: 1
@@ -90,11 +128,9 @@ Retrieves a user with the given `id`.
91```javascript
129```javascript
93− "userName": {
131+ «postBody»: «This is another post body»,
94− "secondName": "Barovich",
132+ «postAuthor»: 4,
95− "firstName": "Foo"
133+ «postId»: 1
@@ -102,11 +138,9 @@ Retrieves a user with the given `id`.
103```javascript
139```javascript
105− "userName": {
141+ «postBody»: «This is the post body»,
106− "secondName": "Fooovich",
142+ «postAuthor»: 7,
107− "firstName": "Bar"
143+ «postId»: 1
@@ -114,50 +148,30 @@ Retrieves a user with the given `id`.
115```javascript
149```javascript
117− "userName": {
151+ «postBody»: «This is another post body»,
118− "secondName": "Quixovich",
152+ «postAuthor»: 7,
119− "firstName": "Qux"
153+ «postId»: 1
125−## WebSocket /posts/subscribe/:token
157+- Example (`application/json`):
127−You access the web socket with the web socket protocol. I. e. `https://` -> `ws://`.
129−Open a web socket from the given `token` for receiving events about new and deleted posts.
131−#### Returns error `498` if the supplied token has expired or is invalid.
136−- *token*: The token, received with the previous request.
140```javascript
159```javascript
142− "token": 1828,
161+ «postBody»: «This is the post body»,
143− "response": {
162+ «postAuthor»: 92,
144− "deleted": [
163+ «postId»: 1
170+_url: [`https://websuck1t.herokuapp.com/users/{id}`](https://websuck1t.herokuapp.com/users/1)_
172+Retrieves a user with the given `id`.
160−#### If there is no post with the given `id`, the method returns error `404`.
174+#### If there is no user with the given `id`, the method returns error `404`.
162### Captures:
176### Captures:
@@ -176,19 +190,11 @@ Open a web socket from the given `token` for receiving events about new and dele
177```javascript
191```javascript
179− "postBody": "This is the post body",
193+ "userName": {
180− "postAuthor": 4,
194+ "secondName": "Leonidovich",
181− "postId": 1
195+ "firstName": "Seva"
185−- Example (`application/json`):
189− "postBody": "This is another post body",
@@ -196,9 +202,11 @@ Open a web socket from the given `token` for receiving events about new and dele
197```javascript
203```javascript
199− "postBody": "This is the post body",
205+ "userName": {
200− "postAuthor": 7,
206+ "secondName": "Barovich",
201− "postId": 1
207+ "firstName": "Foo"
@@ -206,9 +214,11 @@ Open a web socket from the given `token` for receiving events about new and dele
207```javascript
215```javascript
209− "postBody": "This is another post body",
217+ "userName": {
210− "postAuthor": 7,
218+ "secondName": "Fooovich",
211− "postId": 1
219+ "firstName": "Bar"
@@ -216,8 +226,10 @@ Open a web socket from the given `token` for receiving events about new and dele
217```javascript
227```javascript
219− "postBody": "This is the post body",
229+ "userName": {
220− "postAuthor": 92,
230+ "secondName": "Quixovich",
221− "postId": 1
231+ "firstName": "Qux"