@@ -1,223 +0,0 @@
1−# A server example with WebSockets
2−
3−_url: [`https://websuck1t.herokuapp.com`](https://websuck1t.herokuapp.com)_
4−
5−# Methods
6−
7−## GET /posts/all
8−
9−### Response:
10−
11−- Status code 200
12−- Headers: []
13−
14−- Supported content types are:
15−
16− - `application/json`
17−
18−- Example (`application/json`):
19−
20−```javascript
21−{
22− "token": 1,
23− "response": [
24− {
25− "postBody": "This is the post body",
26− "postAuthor": 4,
27− "postId": 1
28− },
29− {
30− "postBody": "This is another post body",
31− "postAuthor": 4,
32− "postId": 2
33− },
34− {
35− "postBody": "This is the post body",
36− "postAuthor": 7,
37− "postId": 3
38− },
39− {
40− "postBody": "This is another post body",
41− "postAuthor": 7,
42− "postId": 4
43− },
44− {
45− "postBody": "This is the post body",
46− "postAuthor": 92,
47− "postId": 5
48− },
49− {
50− "postBody": "This is another post body",
51− "postAuthor": 92,
52− "postId": 6
53− }
54− ]
55−}
56−```
57−
58−## GET /users/:id
59−
60−Retrieves a user with the given `id`.
61−
62−#### If there is no user with the given `id`, the method returns error `404`.
63−
64−### Captures:
65−
66−- *id*: The id of the entity you want to query.
67−
68−### Response:
69−
70−- Status code 200
71−- Headers: []
72−
73−- Supported content types are:
74−
75− - `application/json`
76−
77−- Example (`application/json`):
78−
79−```javascript
80−{
81− "userName": {
82− "secondName": "Leonidovich",
83− "firstName": "Seva"
84− },
85− "userId": 1
86−}
87−```
88−
89−- Example (`application/json`):
90−
91−```javascript
92−{
93− "userName": {
94− "secondName": "Barovich",
95− "firstName": "Foo"
96− },
97− "userId": 42
98−}
99−```
100−
101−- Example (`application/json`):
102−
103−```javascript
104−{
105− "userName": {
106− "secondName": "Fooovich",
107− "firstName": "Bar"
108− },
109− "userId": 69
110−}
111−```
112−
113−- Example (`application/json`):
114−
115−```javascript
116−{
117− "userName": {
118− "secondName": "Quixovich",
119− "firstName": "Qux"
120− },
121− "userId": 8
122−}
123−```
124−
125−## WebSocket /posts/subscribe/:token
126−
127−You access the web socket with the web socket protocol. I. e. `https://` -> `ws://`.
128−
129−Open a web socket from the given `token` for receiving events about new and deleted posts.
130−
131−#### Returns error `498` if the supplied token has expired or is invalid.
132−
133−
134−### Captures:
135−
136−- *token*: The token, received with the previous request.
137−
138−### Response:
139−
140−```javascript
141−{
142− "token": 1828,
143− "response": {
144− "deleted": [
145− 1819,
146− 1835,
147− 1843
148− ],
149− "added": [
150− 1844,
151− 1845,
152− 1846
153− ]
154− }
155−}
156−```
157−
158−## GET /posts/:id
159−
160−#### If there is no post with the given `id`, the method returns error `404`.
161−
162−### Captures:
163−
164−- *id*: The id of the entity you want to query.
165−
166−### Response:
167−
168−- Status code 200
169−- Headers: []
170−
171−- Supported content types are:
172−
173− - `application/json`
174−
175−- Example (`application/json`):
176−
177−```javascript
178−{
179− "postBody": "This is the post body",
180− "postAuthor": 4,
181− "postId": 1
182−}
183−```
184−
185−- Example (`application/json`):
186−
187−```javascript
188−{
189− "postBody": "This is another post body",
190− "postAuthor": 4,
191− "postId": 1
192−}
193−```
194−
195−- Example (`application/json`):
196−
197−```javascript
198−{
199− "postBody": "This is the post body",
200− "postAuthor": 7,
201− "postId": 1
202−}
203−```
204−
205−- Example (`application/json`):
206−
207−```javascript
208−{
209− "postBody": "This is another post body",
210− "postAuthor": 7,
211− "postId": 1
212−}
213−```
214−
215−- Example (`application/json`):
216−
217−```javascript
218−{
219− "postBody": "This is the post body",
220− "postAuthor": 92,
221− "postId": 1
222−}
223−```