Локейшены nginx взяты из примера описания модуля NCHAT.
location = /sub {
nchan_subscriber;
nchan_channel_id foobar;
}
location = /pub {
nchan_publisher;
nchan_channel_id foobar;
}
Для добавления сообщения выполняем в командной строке:
curl --request POST --data "test message" -H "Accept: text/json" http://localhost/pub
Для получения информации о нем:
curl -v --request GET -H "Accept: text/json" http://localhost/pub
Последняя команда выведет:
Hostname was NOT found in DNS cache
Trying 127.0.0.1...
Connected to localhost (127.0.0.1) port 80 (#0)
GET /pub HTTP/1.1
User-Agent: curl/7.35.0
Host: localhost
Accept: text/json
HTTP/1.1 200 OK
Server nginx/1.8.1 is not blacklisted
Server: nginx/1.8.1
Date: Mon, 29 Feb 2016 07:11:41 GMT
Content-Type: text/json
Content-Length: 78
Connection: keep-alive
Connection #0 to host localhost left intact
{"messages": 6, "requested": 799, GETbscribers": 0, "last_message_id": "0:0" }
Т.е. все работает. Из этого у меня появился такой вопрос: как вывести само сообщение а не информацию о нем?