This is a MWE for a sequence diagram using pgf-umlsd: (taken from here)
\documentclass{article}
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{positioning, fit, calc, shapes, arrows}
\usepackage[underline=false]{pgf-umlsd}
\begin{document}
\begin{figure}[H]
\centering
\begin{sequencediagram}
\newinst{c}{Client}
\newinst[6]{s}{Server}
\mess[1]{c}{Longer label}{s}
\mess[1]{s}{label}{c}
\mess[1]{c}{label}{s}
\mess[1]{s}{Longer label}{c}
\end{sequencediagram}
\caption{Client-Server messaging}
\end{figure}
\end{document}
How can each label be aligned in parallel to its corresponding arrow?

\messdoes not provide this. Have a look inpgf-umlsd.sty, you can easily make your own version of\messit is a fairly simple macro. – daleif Jul 21 '17 at 14:13[H], learn to use floats properly, then there is no need for[H]. – daleif Jul 21 '17 at 14:14slopedoption to themidwaynode in the last\pathin the\messdefinition. – daleif Jul 21 '17 at 14:17