[Tex/LaTex] Drawing simple sequence diagram

diagramstikz-pgf

I need to draw this kind of simple sequency diagram, but I'm not very good with TikZ:

sample

\begin{figure}[!ht]
\begin{center}
\begin{tikzpicture}[node distance=2cm,auto,>=stealth']
    \node[] (server) {server};
    \node[left = of server] (client) {client};
    \node[below of=server, node distance=5cm] (server_ground) {};
    \node[below of=client, node distance=5cm] (client_ground) {};
    %
    \draw (client) -- (client_ground);
    \draw (server) -- (server_ground);
    \draw[->] ([yshift=-1cm]client.south) -- ([yshift=-1cm]server.south);
    \draw[->] ([yshift=-1.5cm]server.south) -- ([yshift=-1.5cm]client.south);
\end{tikzpicture}

I also want the lines to be straight and have text over them.

Best Answer

Next time please provide a minimal working example (MWE). This should be the starting point.

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}
\begin{document}
  \begin{tikzpicture}
    \coordinate (a) at (0,0);
    \coordinate (b) at (0,1);
    \coordinate (c) at (1,0);
    \coordinate (d) at (1,1);
    \draw (a) -- (b)node[pos=1.1,scale=0.25]{Client} (c) -- (d)node[pos=1.1,scale=0.25]{Server};
    \draw[-stealth] ($(a)!0.75!(b)$) -- node[above,scale=0.25,midway]{Text}($(c)!0.75!(d)$);
    \draw[stealth-] ($(a)!0.65!(b)$) -- node[below,scale=0.25,midway]{Hey} ($(c)!0.65!(d)$);
  \end{tikzpicture}
\end{document}

enter image description here

And this is how your snippet can be modified:

\documentclass[tikz]{standalone}
\usetikzlibrary{calc,positioning,arrows}
\begin{document}
  \begin{tikzpicture}[node distance=2cm,auto,>=stealth']
    \node[] (server) {server};
    \node[left = of server] (client) {client};
    \node[below of=server, node distance=5cm] (server_ground) {};
    \node[below of=client, node distance=5cm] (client_ground) {};
    %
    \draw (client) -- (client_ground);
    \draw (server) -- (server_ground);
    \draw[->] ($(client)!0.25!(client_ground)$) -- node[above,scale=1,midway]{Text} ($(server)!0.25!(server_ground)$);
    \draw[<-] ($(client)!0.35!(client_ground)$) -- node[below,scale=1,midway]{Hey} ($(server)!0.35!(server_ground)$);
\end{tikzpicture}
\end{document}

enter image description here