Locations of nginx are taken from the example of the NCHAT module description.

location = /sub { nchan_subscriber; nchan_channel_id foobar; } location = /pub { nchan_publisher; nchan_channel_id foobar; } 

To add a message, run the command line:

 curl --request POST --data "test message" -H "Accept: text/json" http://localhost/pub 

For information about him:

 curl -v --request GET -H "Accept: text/json" http://localhost/pub 

The last command will output:

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, Feb 29, 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 "}

Those. everything is working. From this I had a question: how to display the message itself and not information about it?

    1 answer 1

    You need to remove the -v from the curl command.

    • I have not changed anything - JocBro1