Skip to content

Using uwsgi protocol

Roman edited this page Apr 24, 2017 · 1 revision

Using uwsgi Protocol

About this protocol you can read more in official page

This protocol implement genserver which allows for independence from general app.

First step

Start new uwsgi process and start connection with fcgi server

{ok, Pid} = sgi_uwsgi:start(),

We keep pid of process for avoiding copy of data using methods. After this function we keep also connection process.

Send request or data

This protocol much more easy then FastCGI and support sending only once.

Pid ! {overall, self(), CGIParams, has_body(Http), Body},

Receive message with next tags

{sgi_uwsgi_return, Out} % common respones
{sgi_uwsgi_return_error, Err} % some error
{sgi_uwsgi_timeout, Pid} % self timeout

Last step

Stop uwsgi process with the release of resources. Connection process let go also.

sgi_uwsgi:stop(Pid),