\hypertarget{group__usercb}{}\section{User Callback}
\label{group__usercb}\index{User Callback@{User Callback}}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef int \hyperlink{group__usercb_gad4fcb82e68d60ffacca61a3f783a0a2f}{lws\+\_\+callback\+\_\+function}(struct lws $\ast$wsi, enum \hyperlink{group__usercb_gad62860e19975ba4c4af401c3cdb6abf7}{lws\+\_\+callback\+\_\+reasons} reason, void $\ast$user, void $\ast$in, size\+\_\+t len)
\end{DoxyCompactItemize}
\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \hyperlink{group__usercb_gad62860e19975ba4c4af401c3cdb6abf7}{lws\+\_\+callback\+\_\+reasons} \{ \\*
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a24d39bf1cfc0bad9d92da9ac1717e439}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+E\+S\+T\+A\+B\+L\+I\+S\+H\+ED} = 0, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ad8c6207b0c4e732f3d507f0fb79370e8}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+O\+N\+\_\+\+E\+R\+R\+OR} = 1, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa536e574a642ff3ab9e12bff7ba2c6a2}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+P\+R\+E\+\_\+\+E\+S\+T\+A\+B\+L\+I\+SH} = 2, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a7e12418eec9bce85735e6460176ab604}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+E\+S\+T\+A\+B\+L\+I\+S\+H\+ED} = 3, 
\\*
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a48a9590e5e18c7920282e094a0bfd9d8}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+O\+S\+ED} = 4, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a838b18d255c1b94a533287ba302a2eba}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+O\+S\+E\+D\+\_\+\+H\+T\+TP} = 5, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a492c1b1c0ac0ed980042ee732fe2990c}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+C\+E\+I\+VE} = 6, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a2db02fc6e1c17ab62b52109d1aa9d738}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+C\+E\+I\+V\+E\+\_\+\+P\+O\+NG} = 7, 
\\*
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7abbbe7a0a67c5866ca9109d46823fc5b1}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+R\+E\+C\+E\+I\+VE} = 8, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a136a7cec11c3afd13245623bd84e76c9}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+R\+E\+C\+E\+I\+V\+E\+\_\+\+P\+O\+NG} = 9, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a8e8b2e6dbeac76d8d126947d2166a514}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE} = 10, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a7ec8e2e9557ee02a4fc9f7dec7e2babc}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE} = 11, 
\\*
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae8d1de0bb56e03aa58cb4d44b18edd2e}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+TP} = 12, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ac4c68e00efcf1ff7bda7ada462aff8ae}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+B\+O\+DY} = 13, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a2fce9a8608220f32abbf1422a5498804}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+B\+O\+D\+Y\+\_\+\+C\+O\+M\+P\+L\+E\+T\+I\+ON} = 14, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa627548e1296e654fcfab463ec3c9587}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+F\+I\+L\+E\+\_\+\+C\+O\+M\+P\+L\+E\+T\+I\+ON} = 15, 
\\*
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7afedadfb3cde37a8ea4c84ed535f26d09}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE} = 16, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a026502768778b8d79d62dd0fe4375fc6}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+N\+E\+T\+W\+O\+R\+K\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON} = 17, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a75199176c82c1a56e4a6bbf1cc30c12c}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+H\+T\+T\+P\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON} = 18, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae9734e1d7af2abf291665ce9e4a728d3}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+N\+E\+W\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+I\+N\+S\+T\+A\+N\+T\+I\+A\+T\+ED} = 19, 
\\*
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7accd8753672d319a30b4b4c2fb775e84d}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON} = 20, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae4986291b7a810fe290851d73bebeb1c}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+L\+O\+A\+D\+\_\+\+E\+X\+T\+R\+A\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+V\+E\+R\+I\+F\+Y\+\_\+\+C\+E\+R\+TS} = 21, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a06006e98d27e1e884364d88317f83493}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+L\+O\+A\+D\+\_\+\+E\+X\+T\+R\+A\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+V\+E\+R\+I\+F\+Y\+\_\+\+C\+E\+R\+TS} = 22, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae5ad65d779b7eab32ab67ceff91a3bac}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+P\+E\+R\+F\+O\+R\+M\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+E\+R\+T\+\_\+\+V\+E\+R\+I\+F\+I\+C\+A\+T\+I\+ON} = 23, 
\\*
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a909cc2a7018864b0b71abacc4058fd8f}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+A\+P\+P\+E\+N\+D\+\_\+\+H\+A\+N\+D\+S\+H\+A\+K\+E\+\_\+\+H\+E\+A\+D\+ER} = 24, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a390da3639296660a78cc1a5dcb19037e}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+O\+N\+F\+I\+R\+M\+\_\+\+E\+X\+T\+E\+N\+S\+I\+O\+N\+\_\+\+O\+K\+AY} = 25, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a1ce5b22039ca37ee224d00047596ea46}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+O\+N\+F\+I\+R\+M\+\_\+\+E\+X\+T\+E\+N\+S\+I\+O\+N\+\_\+\+S\+U\+P\+P\+O\+R\+T\+ED} = 26, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ad5d34583e3556e153eda91620b48cc49}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+I\+N\+IT} = 27, 
\\*
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a54269ca88508e6efd3afdb9d360a9caa}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+D\+E\+S\+T\+R\+OY} = 28, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7afd8fd77a1cc9405fcb4f26915d7f2d01}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+I\+\_\+\+C\+R\+E\+A\+TE} = 29, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aca834dc035b7f7486f9ce40fde54fe9e}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+I\+\_\+\+D\+E\+S\+T\+R\+OY} = 30, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7adfb41c92e2522712207ef7f2462b5e34}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+G\+E\+T\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+ID} = 31, 
\\*
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ab69783a9fbf2ca71ad70706bda77b412}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+A\+D\+D\+\_\+\+P\+O\+L\+L\+\_\+\+FD} = 32, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a1df60f314710236f9b53efbf468da768}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+D\+E\+L\+\_\+\+P\+O\+L\+L\+\_\+\+FD} = 33, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa87d2e82fffa42c3680c7403ef94216e}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+H\+A\+N\+G\+E\+\_\+\+M\+O\+D\+E\+\_\+\+P\+O\+L\+L\+\_\+\+FD} = 34, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a8909732521d379179003d97ab7a05428}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+L\+O\+C\+K\+\_\+\+P\+O\+LL} = 35, 
\\*
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a0e9e3dd667c0c42cdbe1a3d921f4fd79}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+U\+N\+L\+O\+C\+K\+\_\+\+P\+O\+LL} = 36, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa46f705dcf97502e95627ffde614f98b}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+C\+O\+N\+T\+E\+X\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+S\+\_\+\+P\+R\+I\+V\+A\+T\+E\+\_\+\+K\+EY} = 37, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ac3fc5bbb55e69f90396526287ee84a51}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+\_\+\+P\+E\+E\+R\+\_\+\+I\+N\+I\+T\+I\+A\+T\+E\+D\+\_\+\+C\+L\+O\+SE} = 38, 
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+\_\+\+E\+X\+T\+\_\+\+D\+E\+F\+A\+U\+L\+TS} = 39, 
\\*
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+GI} = 40, 
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+G\+I\+\_\+\+T\+E\+R\+M\+I\+N\+A\+T\+ED} = 41, 
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+G\+I\+\_\+\+S\+T\+D\+I\+N\+\_\+\+D\+A\+TA} = 42, 
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+G\+I\+\_\+\+S\+T\+D\+I\+N\+\_\+\+C\+O\+M\+P\+L\+E\+T\+ED} = 43, 
\\*
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+E\+S\+T\+A\+B\+L\+I\+S\+H\+E\+D\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+H\+T\+TP} = 44, 
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+O\+S\+E\+D\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+H\+T\+TP} = 45, 
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+C\+E\+I\+V\+E\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+H\+T\+TP} = 46, 
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+O\+M\+P\+L\+E\+T\+E\+D\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+H\+T\+TP} = 47, 
\\*
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+C\+E\+I\+V\+E\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+H\+T\+T\+P\+\_\+\+R\+E\+AD} = 48, 
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+B\+I\+N\+D\+\_\+\+P\+R\+O\+T\+O\+C\+OL} = 49, 
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+D\+R\+O\+P\+\_\+\+P\+R\+O\+T\+O\+C\+OL} = 50, 
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+H\+E\+C\+K\+\_\+\+A\+C\+C\+E\+S\+S\+\_\+\+R\+I\+G\+H\+TS} = 51, 
\\*
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+P\+R\+O\+C\+E\+S\+S\+\_\+\+H\+T\+ML} = 52, 
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+A\+D\+D\+\_\+\+H\+E\+A\+D\+E\+RS} = 53, 
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+S\+E\+S\+S\+I\+O\+N\+\_\+\+I\+N\+FO} = 54, 
{\bfseries L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+G\+S\+\_\+\+E\+V\+E\+NT} = 55, 
\\*
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa5cc921b7697743017a533822a3d556a}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+P\+MO} = 56, 
\hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a982579753e70e59a9ea13ce628ac891a}{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+U\+S\+ER} = 1000
 \}
\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{User protocol callback}

The protocol callback is the primary way lws interacts with user code. For one of a list of a few dozen reasons the callback gets called at some event to be handled.

All of the events can be ignored, returning 0 is taken as \char`\"{}\+O\+K\char`\"{} and returning nonzero in most cases indicates that the connection should be closed. 

\subsection{Typedef Documentation}
\index{User Callback@{User Callback}!lws\+\_\+callback\+\_\+function@{lws\+\_\+callback\+\_\+function}}
\index{lws\+\_\+callback\+\_\+function@{lws\+\_\+callback\+\_\+function}!User Callback@{User Callback}}
\subsubsection[{\texorpdfstring{lws\+\_\+callback\+\_\+function}{lws\_callback\_function}}]{\setlength{\rightskip}{0pt plus 5cm}typedef int lws\+\_\+callback\+\_\+function(struct lws $\ast$wsi, enum {\bf lws\+\_\+callback\+\_\+reasons} reason, void $\ast$user, void $\ast$in, size\+\_\+t len)}\hypertarget{group__usercb_gad4fcb82e68d60ffacca61a3f783a0a2f}{}\label{group__usercb_gad4fcb82e68d60ffacca61a3f783a0a2f}


{\ttfamily \#include $<$\hyperlink{libwebsockets_8h}{lib/libwebsockets.\+h}$>$}

typedef \hyperlink{group__usercb_gad4fcb82e68d60ffacca61a3f783a0a2f}{lws\+\_\+callback\+\_\+function()} -\/ User server actions 
\begin{DoxyParams}{Parameters}
{\em wsi} & Opaque websocket instance pointer \\
\hline
{\em reason} & The reason for the call \\
\hline
{\em user} & Pointer to per-\/session user data allocated by library \\
\hline
{\em in} & Pointer used for some callback reasons \\
\hline
{\em len} & Length set for some callback reasons \begin{DoxyVerb} This callback is the way the user controls what is served.  All the
 protocol detail is hidden and handled by the library.

 For each connection / session there is user data allocated that is
 pointed to by "user".  You set the size of this user data area when
 the library is initialized with lws_create_server.\end{DoxyVerb}
 \\
\hline
\end{DoxyParams}


\subsection{Enumeration Type Documentation}
\index{User Callback@{User Callback}!lws\+\_\+callback\+\_\+reasons@{lws\+\_\+callback\+\_\+reasons}}
\index{lws\+\_\+callback\+\_\+reasons@{lws\+\_\+callback\+\_\+reasons}!User Callback@{User Callback}}
\subsubsection[{\texorpdfstring{lws\+\_\+callback\+\_\+reasons}{lws\_callback\_reasons}}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf lws\+\_\+callback\+\_\+reasons}}\hypertarget{group__usercb_gad62860e19975ba4c4af401c3cdb6abf7}{}\label{group__usercb_gad62860e19975ba4c4af401c3cdb6abf7}


{\ttfamily \#include $<$\hyperlink{libwebsockets_8h}{lib/libwebsockets.\+h}$>$}

enum lws\+\_\+callback\+\_\+reasons -\/ reason you\textquotesingle{}re getting a protocol callback \begin{Desc}
\item[Enumerator]\par
\begin{description}
\index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+E\+S\+T\+A\+B\+L\+I\+S\+H\+ED@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+E\+S\+T\+A\+B\+L\+I\+S\+H\+ED}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+E\+S\+T\+A\+B\+L\+I\+S\+H\+ED@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+E\+S\+T\+A\+B\+L\+I\+S\+H\+ED}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+E\+S\+T\+A\+B\+L\+I\+S\+H\+ED\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a24d39bf1cfc0bad9d92da9ac1717e439}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a24d39bf1cfc0bad9d92da9ac1717e439}
}](VH) after the server completes a handshake with an incoming client. If you built the library with ssl support, in is a pointer to the ssl struct associated with the connection or N\+U\+LL. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+O\+N\+\_\+\+E\+R\+R\+OR@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+O\+N\+\_\+\+E\+R\+R\+OR}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+O\+N\+\_\+\+E\+R\+R\+OR@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+O\+N\+\_\+\+E\+R\+R\+OR}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+O\+N\+\_\+\+E\+R\+R\+OR\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ad8c6207b0c4e732f3d507f0fb79370e8}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ad8c6207b0c4e732f3d507f0fb79370e8}
}]the request client connection has been unable to complete a handshake with the remote server. If in is non-\/\+N\+U\+LL, you can find an error string of length len where it points to

Diagnostic strings that may be returned include \begin{DoxyVerb}    "getaddrinfo (ipv6) failed"
    "unknown address family"
    "getaddrinfo (ipv4) failed"
    "set socket opts failed"
    "insert wsi failed"
    "lws_ssl_client_connect1 failed"
    "lws_ssl_client_connect2 failed"
    "Peer hung up"
    "read failed"
    "HS: URI missing"
    "HS: Redirect code but no Location"
    "HS: URI did not parse"
    "HS: Redirect failed"
    "HS: Server did not return 200"
    "HS: OOM"
    "HS: disallowed by client filter"
    "HS: disallowed at ESTABLISHED"
    "HS: ACCEPT missing"
    "HS: ws upgrade response not 101"
    "HS: UPGRADE missing"
    "HS: Upgrade to something other than websocket"
    "HS: CONNECTION missing"
    "HS: UPGRADE malformed"
    "HS: PROTOCOL malformed"
    "HS: Cannot match protocol"
    "HS: EXT: list too big"
    "HS: EXT: failed setting defaults"
    "HS: EXT: failed parsing defaults"
    "HS: EXT: failed parsing options"
    "HS: EXT: Rejects server options"
    "HS: EXT: unknown ext"
    "HS: Accept hash wrong"
    "HS: Rejected by filter cb"
    "HS: OOM"
    "HS: SO_SNDBUF failed"
    "HS: Rejected at CLIENT_ESTABLISHED"\end{DoxyVerb}
 \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+P\+R\+E\+\_\+\+E\+S\+T\+A\+B\+L\+I\+SH@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+P\+R\+E\+\_\+\+E\+S\+T\+A\+B\+L\+I\+SH}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+P\+R\+E\+\_\+\+E\+S\+T\+A\+B\+L\+I\+SH@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+P\+R\+E\+\_\+\+E\+S\+T\+A\+B\+L\+I\+SH}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+P\+R\+E\+\_\+\+E\+S\+T\+A\+B\+L\+I\+SH\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa536e574a642ff3ab9e12bff7ba2c6a2}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa536e574a642ff3ab9e12bff7ba2c6a2}
}]this is the last chance for the client user code to examine the http headers and decide to reject the connection. If the content in the headers is interesting to the client (url, etc) it needs to copy it out at this point since it will be destroyed before the C\+L\+I\+E\+N\+T\+\_\+\+E\+S\+T\+A\+B\+L\+I\+S\+H\+ED call \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+E\+S\+T\+A\+B\+L\+I\+S\+H\+ED@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+E\+S\+T\+A\+B\+L\+I\+S\+H\+ED}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+E\+S\+T\+A\+B\+L\+I\+S\+H\+ED@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+E\+S\+T\+A\+B\+L\+I\+S\+H\+ED}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+E\+S\+T\+A\+B\+L\+I\+S\+H\+ED\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a7e12418eec9bce85735e6460176ab604}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a7e12418eec9bce85735e6460176ab604}
}]after your client connection completed a handshake with the remote server \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+O\+S\+ED@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+O\+S\+ED}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+O\+S\+ED@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+O\+S\+ED}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+O\+S\+ED\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a48a9590e5e18c7920282e094a0bfd9d8}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a48a9590e5e18c7920282e094a0bfd9d8}
}]when the websocket session ends \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+O\+S\+E\+D\+\_\+\+H\+T\+TP@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+O\+S\+E\+D\+\_\+\+H\+T\+TP}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+O\+S\+E\+D\+\_\+\+H\+T\+TP@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+O\+S\+E\+D\+\_\+\+H\+T\+TP}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+O\+S\+E\+D\+\_\+\+H\+T\+TP\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a838b18d255c1b94a533287ba302a2eba}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a838b18d255c1b94a533287ba302a2eba}
}]when a H\+T\+TP (non-\/websocket) session ends \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+C\+E\+I\+VE@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+C\+E\+I\+VE}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+C\+E\+I\+VE@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+C\+E\+I\+VE}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+C\+E\+I\+VE\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a492c1b1c0ac0ed980042ee732fe2990c}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a492c1b1c0ac0ed980042ee732fe2990c}
}]data has appeared for this server endpoint from a remote client, it can be found at $\ast$in and is len bytes long \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+C\+E\+I\+V\+E\+\_\+\+P\+O\+NG@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+C\+E\+I\+V\+E\+\_\+\+P\+O\+NG}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+C\+E\+I\+V\+E\+\_\+\+P\+O\+NG@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+C\+E\+I\+V\+E\+\_\+\+P\+O\+NG}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+R\+E\+C\+E\+I\+V\+E\+\_\+\+P\+O\+NG\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a2db02fc6e1c17ab62b52109d1aa9d738}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a2db02fc6e1c17ab62b52109d1aa9d738}
}]servers receive P\+O\+NG packets with this callback reason \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+R\+E\+C\+E\+I\+VE@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+R\+E\+C\+E\+I\+VE}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+R\+E\+C\+E\+I\+VE@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+R\+E\+C\+E\+I\+VE}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+R\+E\+C\+E\+I\+VE\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7abbbe7a0a67c5866ca9109d46823fc5b1}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7abbbe7a0a67c5866ca9109d46823fc5b1}
}]data has appeared from the server for the client connection, it can be found at $\ast$in and is len bytes long \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+R\+E\+C\+E\+I\+V\+E\+\_\+\+P\+O\+NG@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+R\+E\+C\+E\+I\+V\+E\+\_\+\+P\+O\+NG}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+R\+E\+C\+E\+I\+V\+E\+\_\+\+P\+O\+NG@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+R\+E\+C\+E\+I\+V\+E\+\_\+\+P\+O\+NG}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+R\+E\+C\+E\+I\+V\+E\+\_\+\+P\+O\+NG\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a136a7cec11c3afd13245623bd84e76c9}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a136a7cec11c3afd13245623bd84e76c9}
}]clients receive P\+O\+NG packets with this callback reason \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a8e8b2e6dbeac76d8d126947d2166a514}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a8e8b2e6dbeac76d8d126947d2166a514}
}]If you call \hyperlink{group__callback-when-writeable_ga941caaa468bc507b1cae52275f58800d}{lws\+\_\+callback\+\_\+on\+\_\+writable()} on a connection, you will get one of these callbacks coming when the connection socket is able to accept another write packet without blocking. If it already was able to take another packet without blocking, you\textquotesingle{}ll get this callback at the next call to the service loop function. Notice that C\+L\+I\+E\+N\+Ts get L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE and servers get L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a7ec8e2e9557ee02a4fc9f7dec7e2babc}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a7ec8e2e9557ee02a4fc9f7dec7e2babc}
}]See L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+TP@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+TP}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+TP@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+TP}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+TP\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae8d1de0bb56e03aa58cb4d44b18edd2e}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae8d1de0bb56e03aa58cb4d44b18edd2e}
}]an http request has come from a client that is not asking to upgrade the connection to a websocket one. This is a chance to serve http content, for example, to send a script to the client which will then open the websockets connection. in points to the U\+RI path requested and \hyperlink{group__httpft_gab393a06d3d2722af4c3f8b06842c80d7}{lws\+\_\+serve\+\_\+http\+\_\+file()} makes it very simple to send back a file to the client. Normally after sending the file you are done with the http connection, since the rest of the activity will come by websockets from the script that was delivered by http, so you will want to return 1; to close and free up the connection. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+B\+O\+DY@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+B\+O\+DY}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+B\+O\+DY@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+B\+O\+DY}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+B\+O\+DY\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ac4c68e00efcf1ff7bda7ada462aff8ae}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ac4c68e00efcf1ff7bda7ada462aff8ae}
}]the next len bytes data from the http request body H\+T\+TP connection is now available in in. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+B\+O\+D\+Y\+\_\+\+C\+O\+M\+P\+L\+E\+T\+I\+ON@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+B\+O\+D\+Y\+\_\+\+C\+O\+M\+P\+L\+E\+T\+I\+ON}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+B\+O\+D\+Y\+\_\+\+C\+O\+M\+P\+L\+E\+T\+I\+ON@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+B\+O\+D\+Y\+\_\+\+C\+O\+M\+P\+L\+E\+T\+I\+ON}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+B\+O\+D\+Y\+\_\+\+C\+O\+M\+P\+L\+E\+T\+I\+ON\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a2fce9a8608220f32abbf1422a5498804}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a2fce9a8608220f32abbf1422a5498804}
}]the expected amount of http request body has been delivered \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+F\+I\+L\+E\+\_\+\+C\+O\+M\+P\+L\+E\+T\+I\+ON@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+F\+I\+L\+E\+\_\+\+C\+O\+M\+P\+L\+E\+T\+I\+ON}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+F\+I\+L\+E\+\_\+\+C\+O\+M\+P\+L\+E\+T\+I\+ON@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+F\+I\+L\+E\+\_\+\+C\+O\+M\+P\+L\+E\+T\+I\+ON}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+F\+I\+L\+E\+\_\+\+C\+O\+M\+P\+L\+E\+T\+I\+ON\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa627548e1296e654fcfab463ec3c9587}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa627548e1296e654fcfab463ec3c9587}
}]a file requested to be sent down http link has completed. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+W\+R\+I\+T\+E\+A\+B\+LE\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7afedadfb3cde37a8ea4c84ed535f26d09}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7afedadfb3cde37a8ea4c84ed535f26d09}
}]you can write more down the http protocol link now. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+N\+E\+T\+W\+O\+R\+K\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+N\+E\+T\+W\+O\+R\+K\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+N\+E\+T\+W\+O\+R\+K\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+N\+E\+T\+W\+O\+R\+K\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+N\+E\+T\+W\+O\+R\+K\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a026502768778b8d79d62dd0fe4375fc6}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a026502768778b8d79d62dd0fe4375fc6}
}]called when a client connects to the server at network level; the connection is accepted but then passed to this callback to decide whether to hang up immediately or not, based on the client IP. in contains the connection socket\textquotesingle{}s descriptor. Since the client connection information is not available yet, wsi still pointing to the main server socket. Return non-\/zero to terminate the connection before sending or receiving anything. Because this happens immediately after the network connection from the client, there\textquotesingle{}s no websocket protocol selected yet so this callback is issued only to protocol 0. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+H\+T\+T\+P\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+H\+T\+T\+P\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+H\+T\+T\+P\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+H\+T\+T\+P\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+H\+T\+T\+P\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a75199176c82c1a56e4a6bbf1cc30c12c}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a75199176c82c1a56e4a6bbf1cc30c12c}
}]called when the request has been received and parsed from the client, but the response is not sent yet. Return non-\/zero to disallow the connection. user is a pointer to the connection user space allocation, in is the U\+RI, eg, \char`\"{}/\char`\"{} In your handler you can use the public A\+P\+Is \hyperlink{group__HTTP-headers-read_ga8ade0e1ffb0da7e62b989d8d867bf6c8}{lws\+\_\+hdr\+\_\+total\+\_\+length()} / \hyperlink{group__HTTP-headers-read_ga6ce6aa1c0155ea42b7708bed271d1c77}{lws\+\_\+hdr\+\_\+copy()} to access all of the headers using the header enums lws\+\_\+token\+\_\+indexes from \hyperlink{libwebsockets_8h}{libwebsockets.\+h} to check for and read the supported header presence and content before deciding to allow the http connection to proceed or to kill the connection. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+N\+E\+W\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+I\+N\+S\+T\+A\+N\+T\+I\+A\+T\+ED@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+N\+E\+W\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+I\+N\+S\+T\+A\+N\+T\+I\+A\+T\+ED}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+N\+E\+W\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+I\+N\+S\+T\+A\+N\+T\+I\+A\+T\+ED@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+N\+E\+W\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+I\+N\+S\+T\+A\+N\+T\+I\+A\+T\+ED}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+N\+E\+W\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+I\+N\+S\+T\+A\+N\+T\+I\+A\+T\+ED\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae9734e1d7af2abf291665ce9e4a728d3}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae9734e1d7af2abf291665ce9e4a728d3}
}]A new client just had been connected, accepted, and instantiated into the pool. This callback allows setting any relevant property to it. Because this happens immediately after the instantiation of a new client, there\textquotesingle{}s no websocket protocol selected yet so this callback is issued only to protocol 0. Only wsi is defined, pointing to the new client, and the return value is ignored. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+F\+I\+L\+T\+E\+R\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+C\+O\+N\+N\+E\+C\+T\+I\+ON\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7accd8753672d319a30b4b4c2fb775e84d}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7accd8753672d319a30b4b4c2fb775e84d}
}]called when the handshake has been received and parsed from the client, but the response is not sent yet. Return non-\/zero to disallow the connection. user is a pointer to the connection user space allocation, in is the requested protocol name In your handler you can use the public A\+P\+Is \hyperlink{group__HTTP-headers-read_ga8ade0e1ffb0da7e62b989d8d867bf6c8}{lws\+\_\+hdr\+\_\+total\+\_\+length()} / \hyperlink{group__HTTP-headers-read_ga6ce6aa1c0155ea42b7708bed271d1c77}{lws\+\_\+hdr\+\_\+copy()} to access all of the headers using the header enums lws\+\_\+token\+\_\+indexes from \hyperlink{libwebsockets_8h}{libwebsockets.\+h} to check for and read the supported header presence and content before deciding to allow the handshake to proceed or to kill the connection. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+L\+O\+A\+D\+\_\+\+E\+X\+T\+R\+A\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+V\+E\+R\+I\+F\+Y\+\_\+\+C\+E\+R\+TS@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+L\+O\+A\+D\+\_\+\+E\+X\+T\+R\+A\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+V\+E\+R\+I\+F\+Y\+\_\+\+C\+E\+R\+TS}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+L\+O\+A\+D\+\_\+\+E\+X\+T\+R\+A\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+V\+E\+R\+I\+F\+Y\+\_\+\+C\+E\+R\+TS@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+L\+O\+A\+D\+\_\+\+E\+X\+T\+R\+A\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+V\+E\+R\+I\+F\+Y\+\_\+\+C\+E\+R\+TS}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+L\+O\+A\+D\+\_\+\+E\+X\+T\+R\+A\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+V\+E\+R\+I\+F\+Y\+\_\+\+C\+E\+R\+TS\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae4986291b7a810fe290851d73bebeb1c}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae4986291b7a810fe290851d73bebeb1c}
}]if configured for including Open\+S\+SL support, this callback allows your user code to perform extra S\+S\+L\+\_\+\+C\+T\+X\+\_\+load\+\_\+verify\+\_\+locations() or similar calls to direct Open\+S\+SL where to find certificates the client can use to confirm the remote server identity. user is the Open\+S\+SL S\+S\+L\+\_\+\+C\+T\+X$\ast$ \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+L\+O\+A\+D\+\_\+\+E\+X\+T\+R\+A\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+V\+E\+R\+I\+F\+Y\+\_\+\+C\+E\+R\+TS@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+L\+O\+A\+D\+\_\+\+E\+X\+T\+R\+A\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+V\+E\+R\+I\+F\+Y\+\_\+\+C\+E\+R\+TS}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+L\+O\+A\+D\+\_\+\+E\+X\+T\+R\+A\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+V\+E\+R\+I\+F\+Y\+\_\+\+C\+E\+R\+TS@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+L\+O\+A\+D\+\_\+\+E\+X\+T\+R\+A\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+V\+E\+R\+I\+F\+Y\+\_\+\+C\+E\+R\+TS}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+L\+O\+A\+D\+\_\+\+E\+X\+T\+R\+A\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+V\+E\+R\+I\+F\+Y\+\_\+\+C\+E\+R\+TS\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a06006e98d27e1e884364d88317f83493}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a06006e98d27e1e884364d88317f83493}
}]if configured for including Open\+S\+SL support, this callback allows your user code to load extra certifcates into the server which allow it to verify the validity of certificates returned by clients. user is the server\textquotesingle{}s Open\+S\+SL S\+S\+L\+\_\+\+C\+T\+X$\ast$ \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+P\+E\+R\+F\+O\+R\+M\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+E\+R\+T\+\_\+\+V\+E\+R\+I\+F\+I\+C\+A\+T\+I\+ON@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+P\+E\+R\+F\+O\+R\+M\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+E\+R\+T\+\_\+\+V\+E\+R\+I\+F\+I\+C\+A\+T\+I\+ON}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+P\+E\+R\+F\+O\+R\+M\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+E\+R\+T\+\_\+\+V\+E\+R\+I\+F\+I\+C\+A\+T\+I\+ON@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+P\+E\+R\+F\+O\+R\+M\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+E\+R\+T\+\_\+\+V\+E\+R\+I\+F\+I\+C\+A\+T\+I\+ON}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+P\+E\+R\+F\+O\+R\+M\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+E\+R\+T\+\_\+\+V\+E\+R\+I\+F\+I\+C\+A\+T\+I\+ON\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae5ad65d779b7eab32ab67ceff91a3bac}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae5ad65d779b7eab32ab67ceff91a3bac}
}]if the libwebsockets vhost was created with the option L\+W\+S\+\_\+\+S\+E\+R\+V\+E\+R\+\_\+\+O\+P\+T\+I\+O\+N\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+\_\+\+V\+A\+L\+I\+D\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+E\+RT, then this callback is generated during Open\+S\+SL verification of the cert sent from the client. It is sent to protocol\mbox{[}0\mbox{]} callback as no protocol has been negotiated on the connection yet. Notice that the libwebsockets context and wsi are both N\+U\+LL during this callback. See \href{http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html}{\tt http\+://www.\+openssl.\+org/docs/ssl/\+S\+S\+L\+\_\+\+C\+T\+X\+\_\+set\+\_\+verify.\+html} to understand more detail about the Open\+S\+SL callback that generates this libwebsockets callback and the meanings of the arguments passed. In this callback, user is the x509\+\_\+ctx, in is the ssl pointer and len is preverify\+\_\+ok Notice that this callback maintains libwebsocket return conventions, return 0 to mean the cert is OK or 1 to fail it. This also means that if you don\textquotesingle{}t handle this callback then the default callback action of returning 0 allows the client certificates. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+A\+P\+P\+E\+N\+D\+\_\+\+H\+A\+N\+D\+S\+H\+A\+K\+E\+\_\+\+H\+E\+A\+D\+ER@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+A\+P\+P\+E\+N\+D\+\_\+\+H\+A\+N\+D\+S\+H\+A\+K\+E\+\_\+\+H\+E\+A\+D\+ER}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+A\+P\+P\+E\+N\+D\+\_\+\+H\+A\+N\+D\+S\+H\+A\+K\+E\+\_\+\+H\+E\+A\+D\+ER@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+A\+P\+P\+E\+N\+D\+\_\+\+H\+A\+N\+D\+S\+H\+A\+K\+E\+\_\+\+H\+E\+A\+D\+ER}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+A\+P\+P\+E\+N\+D\+\_\+\+H\+A\+N\+D\+S\+H\+A\+K\+E\+\_\+\+H\+E\+A\+D\+ER\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a909cc2a7018864b0b71abacc4058fd8f}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a909cc2a7018864b0b71abacc4058fd8f}
}]this callback happens when a client handshake is being compiled. user is N\+U\+LL, in is a char $\ast$$\ast$, it\textquotesingle{}s pointing to a char $\ast$ which holds the next location in the header buffer where you can add headers, and len is the remaining space in the header buffer, which is typically some hundreds of bytes. So, to add a canned cookie, your handler code might look similar to\+: \begin{DoxyVerb} char **p = (char **)in;

 if (len < 100)
    return 1;

 *p += sprintf(*p, "Cookie: a=b\x0d\x0a");

 return 0;
\end{DoxyVerb}


Notice if you add anything, you just have to take care about the C\+R\+LF on the line you added. Obviously this callback is optional, if you don\textquotesingle{}t handle it everything is fine.

Notice the callback is coming to protocols\mbox{[}0\mbox{]} all the time, because there is no specific protocol negotiated yet. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+O\+N\+F\+I\+R\+M\+\_\+\+E\+X\+T\+E\+N\+S\+I\+O\+N\+\_\+\+O\+K\+AY@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+O\+N\+F\+I\+R\+M\+\_\+\+E\+X\+T\+E\+N\+S\+I\+O\+N\+\_\+\+O\+K\+AY}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+O\+N\+F\+I\+R\+M\+\_\+\+E\+X\+T\+E\+N\+S\+I\+O\+N\+\_\+\+O\+K\+AY@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+O\+N\+F\+I\+R\+M\+\_\+\+E\+X\+T\+E\+N\+S\+I\+O\+N\+\_\+\+O\+K\+AY}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+O\+N\+F\+I\+R\+M\+\_\+\+E\+X\+T\+E\+N\+S\+I\+O\+N\+\_\+\+O\+K\+AY\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a390da3639296660a78cc1a5dcb19037e}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a390da3639296660a78cc1a5dcb19037e}
}]When the server handshake code sees that it does support a requested extension, before accepting the extension by additing to the list sent back to the client it gives this callback just to check that it\textquotesingle{}s okay to use that extension. It calls back to the requested protocol and with in being the extension name, len is 0 and user is valid. Note though at this time the E\+S\+T\+A\+B\+L\+I\+S\+H\+ED callback hasn\textquotesingle{}t happened yet so if you initialize user content there, user content during this callback might not be useful for anything. Notice this callback comes to protocols\mbox{[}0\mbox{]}. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+O\+N\+F\+I\+R\+M\+\_\+\+E\+X\+T\+E\+N\+S\+I\+O\+N\+\_\+\+S\+U\+P\+P\+O\+R\+T\+ED@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+O\+N\+F\+I\+R\+M\+\_\+\+E\+X\+T\+E\+N\+S\+I\+O\+N\+\_\+\+S\+U\+P\+P\+O\+R\+T\+ED}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+O\+N\+F\+I\+R\+M\+\_\+\+E\+X\+T\+E\+N\+S\+I\+O\+N\+\_\+\+S\+U\+P\+P\+O\+R\+T\+ED@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+O\+N\+F\+I\+R\+M\+\_\+\+E\+X\+T\+E\+N\+S\+I\+O\+N\+\_\+\+S\+U\+P\+P\+O\+R\+T\+ED}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+L\+I\+E\+N\+T\+\_\+\+C\+O\+N\+F\+I\+R\+M\+\_\+\+E\+X\+T\+E\+N\+S\+I\+O\+N\+\_\+\+S\+U\+P\+P\+O\+R\+T\+ED\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a1ce5b22039ca37ee224d00047596ea46}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a1ce5b22039ca37ee224d00047596ea46}
}]When a client connection is being prepared to start a handshake to a server, each supported extension is checked with protocols\mbox{[}0\mbox{]} callback with this reason, giving the user code a chance to suppress the claim to support that extension by returning non-\/zero. If unhandled, by default 0 will be returned and the extension support included in the header to the server. Notice this callback comes to protocols\mbox{[}0\mbox{]}. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+I\+N\+IT@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+I\+N\+IT}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+I\+N\+IT@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+I\+N\+IT}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+I\+N\+IT\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ad5d34583e3556e153eda91620b48cc49}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ad5d34583e3556e153eda91620b48cc49}
}]One-\/time call per protocol, per-\/vhost using it, so it can do initial setup / allocations etc \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+D\+E\+S\+T\+R\+OY@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+D\+E\+S\+T\+R\+OY}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+D\+E\+S\+T\+R\+OY@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+D\+E\+S\+T\+R\+OY}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+P\+R\+O\+T\+O\+C\+O\+L\+\_\+\+D\+E\+S\+T\+R\+OY\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a54269ca88508e6efd3afdb9d360a9caa}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a54269ca88508e6efd3afdb9d360a9caa}
}]One-\/time call per protocol, per-\/vhost using it, indicating this protocol won\textquotesingle{}t get used at all after this callback, the vhost is getting destroyed. Take the opportunity to deallocate everything that was allocated by the protocol. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+I\+\_\+\+C\+R\+E\+A\+TE@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+I\+\_\+\+C\+R\+E\+A\+TE}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+I\+\_\+\+C\+R\+E\+A\+TE@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+I\+\_\+\+C\+R\+E\+A\+TE}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+I\+\_\+\+C\+R\+E\+A\+TE\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7afd8fd77a1cc9405fcb4f26915d7f2d01}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7afd8fd77a1cc9405fcb4f26915d7f2d01}
}]outermost (earliest) wsi create notification to protocols\mbox{[}0\mbox{]} \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+I\+\_\+\+D\+E\+S\+T\+R\+OY@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+I\+\_\+\+D\+E\+S\+T\+R\+OY}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+I\+\_\+\+D\+E\+S\+T\+R\+OY@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+I\+\_\+\+D\+E\+S\+T\+R\+OY}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+I\+\_\+\+D\+E\+S\+T\+R\+OY\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aca834dc035b7f7486f9ce40fde54fe9e}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aca834dc035b7f7486f9ce40fde54fe9e}
}]outermost (latest) wsi destroy notification to protocols\mbox{[}0\mbox{]} \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+G\+E\+T\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+ID@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+G\+E\+T\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+ID}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+G\+E\+T\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+ID@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+G\+E\+T\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+ID}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+G\+E\+T\+\_\+\+T\+H\+R\+E\+A\+D\+\_\+\+ID\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7adfb41c92e2522712207ef7f2462b5e34}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7adfb41c92e2522712207ef7f2462b5e34}
}]lws can accept callback when writable requests from other threads, if you implement this callback and return an opaque current thread ID integer. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+A\+D\+D\+\_\+\+P\+O\+L\+L\+\_\+\+FD@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+A\+D\+D\+\_\+\+P\+O\+L\+L\+\_\+\+FD}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+A\+D\+D\+\_\+\+P\+O\+L\+L\+\_\+\+FD@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+A\+D\+D\+\_\+\+P\+O\+L\+L\+\_\+\+FD}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+A\+D\+D\+\_\+\+P\+O\+L\+L\+\_\+\+FD\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ab69783a9fbf2ca71ad70706bda77b412}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ab69783a9fbf2ca71ad70706bda77b412}
}]lws normally deals with its poll() or other event loop internally, but in the case you are integrating with another server you will need to have lws sockets share a polling array with the other server. This and the other P\+O\+L\+L\+\_\+\+FD related callbacks let you put your specialized poll array interface code in the callback for protocol 0, the first protocol you support, usually the H\+T\+TP protocol in the serving case. This callback happens when a socket needs to be added to the polling loop\+: in points to a struct \hyperlink{structlws__pollargs}{lws\+\_\+pollargs}; the fd member of the struct is the file descriptor, and events contains the active events

If you are using the internal lws polling / event loop you can just ignore these callbacks. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+D\+E\+L\+\_\+\+P\+O\+L\+L\+\_\+\+FD@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+D\+E\+L\+\_\+\+P\+O\+L\+L\+\_\+\+FD}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+D\+E\+L\+\_\+\+P\+O\+L\+L\+\_\+\+FD@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+D\+E\+L\+\_\+\+P\+O\+L\+L\+\_\+\+FD}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+D\+E\+L\+\_\+\+P\+O\+L\+L\+\_\+\+FD\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a1df60f314710236f9b53efbf468da768}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a1df60f314710236f9b53efbf468da768}
}]This callback happens when a socket descriptor needs to be removed from an external polling array. in is again the struct \hyperlink{structlws__pollargs}{lws\+\_\+pollargs} containing the fd member to be removed. If you are using the internal polling loop, you can just ignore it. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+H\+A\+N\+G\+E\+\_\+\+M\+O\+D\+E\+\_\+\+P\+O\+L\+L\+\_\+\+FD@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+H\+A\+N\+G\+E\+\_\+\+M\+O\+D\+E\+\_\+\+P\+O\+L\+L\+\_\+\+FD}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+H\+A\+N\+G\+E\+\_\+\+M\+O\+D\+E\+\_\+\+P\+O\+L\+L\+\_\+\+FD@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+H\+A\+N\+G\+E\+\_\+\+M\+O\+D\+E\+\_\+\+P\+O\+L\+L\+\_\+\+FD}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+C\+H\+A\+N\+G\+E\+\_\+\+M\+O\+D\+E\+\_\+\+P\+O\+L\+L\+\_\+\+FD\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa87d2e82fffa42c3680c7403ef94216e}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa87d2e82fffa42c3680c7403ef94216e}
}]This callback happens when lws wants to modify the events for a connection. in is the struct \hyperlink{structlws__pollargs}{lws\+\_\+pollargs} with the fd to change. The new event mask is in events member and the old mask is in the prev\+\_\+events member. If you are using the internal polling loop, you can just ignore it. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+L\+O\+C\+K\+\_\+\+P\+O\+LL@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+L\+O\+C\+K\+\_\+\+P\+O\+LL}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+L\+O\+C\+K\+\_\+\+P\+O\+LL@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+L\+O\+C\+K\+\_\+\+P\+O\+LL}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+L\+O\+C\+K\+\_\+\+P\+O\+LL\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a8909732521d379179003d97ab7a05428}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a8909732521d379179003d97ab7a05428}
}]These allow the external poll changes driven by lws to participate in an external thread locking scheme around the changes, so the whole thing is threadsafe. These are called around three activities in the library,
\begin{DoxyItemize}
\item inserting a new wsi in the wsi / fd table (len=1)
\item deleting a wsi from the wsi / fd table (len=1)
\item changing a wsi\textquotesingle{}s P\+O\+L\+L\+I\+N/\+O\+UT state (len=0) Locking and unlocking external synchronization objects when len == 1 allows external threads to be synchronized against wsi lifecycle changes if it acquires the same lock for the duration of wsi dereference from the other thread context. 
\end{DoxyItemize}\index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+U\+N\+L\+O\+C\+K\+\_\+\+P\+O\+LL@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+U\+N\+L\+O\+C\+K\+\_\+\+P\+O\+LL}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+U\+N\+L\+O\+C\+K\+\_\+\+P\+O\+LL@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+U\+N\+L\+O\+C\+K\+\_\+\+P\+O\+LL}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+U\+N\+L\+O\+C\+K\+\_\+\+P\+O\+LL\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a0e9e3dd667c0c42cdbe1a3d921f4fd79}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a0e9e3dd667c0c42cdbe1a3d921f4fd79}
}]See L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+L\+O\+C\+K\+\_\+\+P\+O\+LL, ignore if using lws internal poll \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+C\+O\+N\+T\+E\+X\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+S\+\_\+\+P\+R\+I\+V\+A\+T\+E\+\_\+\+K\+EY@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+C\+O\+N\+T\+E\+X\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+S\+\_\+\+P\+R\+I\+V\+A\+T\+E\+\_\+\+K\+EY}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+C\+O\+N\+T\+E\+X\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+S\+\_\+\+P\+R\+I\+V\+A\+T\+E\+\_\+\+K\+EY@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+C\+O\+N\+T\+E\+X\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+S\+\_\+\+P\+R\+I\+V\+A\+T\+E\+\_\+\+K\+EY}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+O\+P\+E\+N\+S\+S\+L\+\_\+\+C\+O\+N\+T\+E\+X\+T\+\_\+\+R\+E\+Q\+U\+I\+R\+E\+S\+\_\+\+P\+R\+I\+V\+A\+T\+E\+\_\+\+K\+EY\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa46f705dcf97502e95627ffde614f98b}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa46f705dcf97502e95627ffde614f98b}
}]if configured for including Open\+S\+SL support but no private key file has been specified (ssl\+\_\+private\+\_\+key\+\_\+filepath is N\+U\+LL), this is called to allow the user to set the private key directly via libopenssl and perform further operations if required; this might be useful in situations where the private key is not directly accessible by the OS, for example if it is stored on a smartcard. user is the server\textquotesingle{}s Open\+S\+SL S\+S\+L\+\_\+\+C\+T\+X$\ast$ \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+\_\+\+P\+E\+E\+R\+\_\+\+I\+N\+I\+T\+I\+A\+T\+E\+D\+\_\+\+C\+L\+O\+SE@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+\_\+\+P\+E\+E\+R\+\_\+\+I\+N\+I\+T\+I\+A\+T\+E\+D\+\_\+\+C\+L\+O\+SE}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+\_\+\+P\+E\+E\+R\+\_\+\+I\+N\+I\+T\+I\+A\+T\+E\+D\+\_\+\+C\+L\+O\+SE@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+\_\+\+P\+E\+E\+R\+\_\+\+I\+N\+I\+T\+I\+A\+T\+E\+D\+\_\+\+C\+L\+O\+SE}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+W\+S\+\_\+\+P\+E\+E\+R\+\_\+\+I\+N\+I\+T\+I\+A\+T\+E\+D\+\_\+\+C\+L\+O\+SE\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ac3fc5bbb55e69f90396526287ee84a51}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ac3fc5bbb55e69f90396526287ee84a51}
}]The peer has sent an unsolicited Close WS packet. in and len are the optional close code (first 2 bytes, network order) and the optional additional information which is not defined in the standard, and may be a string or non-\/human-\/ readable data. If you return 0 lws will echo the close and then close the connection. If you return nonzero lws will just close the connection. \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+P\+MO@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+P\+MO}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+P\+MO@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+P\+MO}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+T\+P\+\_\+\+P\+MO\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa5cc921b7697743017a533822a3d556a}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa5cc921b7697743017a533822a3d556a}
}]per-\/mount options for this connection, called before the normal L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+H\+T\+TP when the mount has per-\/mount options \index{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+U\+S\+ER@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+U\+S\+ER}!User Callback@{User Callback}}\index{User Callback@{User Callback}!L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+U\+S\+ER@{L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+U\+S\+ER}}\item[{\em 
L\+W\+S\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+\_\+\+U\+S\+ER\hypertarget{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a982579753e70e59a9ea13ce628ac891a}{}\label{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a982579753e70e59a9ea13ce628ac891a}
}]user code can use any including / above without fear of clashes \end{description}
\end{Desc}

\begin{DoxyCode}
577                           \{
578         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a24d39bf1cfc0bad9d92da9ac1717e439}{LWS\_CALLBACK\_ESTABLISHED}                                =  0,
582         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ad8c6207b0c4e732f3d507f0fb79370e8}{LWS\_CALLBACK\_CLIENT\_CONNECTION\_ERROR}                        =  
      1,
626         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa536e574a642ff3ab9e12bff7ba2c6a2}{LWS\_CALLBACK\_CLIENT\_FILTER\_PRE\_ESTABLISH}                =  
      2,
633         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a7e12418eec9bce85735e6460176ab604}{LWS\_CALLBACK\_CLIENT\_ESTABLISHED}                          =  3,
636         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a48a9590e5e18c7920282e094a0bfd9d8}{LWS\_CALLBACK\_CLOSED}                                  =  4,
638         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a838b18d255c1b94a533287ba302a2eba}{LWS\_CALLBACK\_CLOSED\_HTTP}                                =  5,
640         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a492c1b1c0ac0ed980042ee732fe2990c}{LWS\_CALLBACK\_RECEIVE}                                        =  6,
644         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a2db02fc6e1c17ab62b52109d1aa9d738}{LWS\_CALLBACK\_RECEIVE\_PONG}                              =  7,
646         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7abbbe7a0a67c5866ca9109d46823fc5b1}{LWS\_CALLBACK\_CLIENT\_RECEIVE}                          =  8,
649         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a136a7cec11c3afd13245623bd84e76c9}{LWS\_CALLBACK\_CLIENT\_RECEIVE\_PONG}                        =  9,
651         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a8e8b2e6dbeac76d8d126947d2166a514}{LWS\_CALLBACK\_CLIENT\_WRITEABLE}                              = 10,
659         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a7ec8e2e9557ee02a4fc9f7dec7e2babc}{LWS\_CALLBACK\_SERVER\_WRITEABLE}                              = 11,
661         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae8d1de0bb56e03aa58cb4d44b18edd2e}{LWS\_CALLBACK\_HTTP}                                      = 12,
675         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ac4c68e00efcf1ff7bda7ada462aff8ae}{LWS\_CALLBACK\_HTTP\_BODY}                                    = 13,
678         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a2fce9a8608220f32abbf1422a5498804}{LWS\_CALLBACK\_HTTP\_BODY\_COMPLETION}                      = 14,
680         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa627548e1296e654fcfab463ec3c9587}{LWS\_CALLBACK\_HTTP\_FILE\_COMPLETION}                      = 15,
682         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7afedadfb3cde37a8ea4c84ed535f26d09}{LWS\_CALLBACK\_HTTP\_WRITEABLE}                          = 16,
684         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a026502768778b8d79d62dd0fe4375fc6}{LWS\_CALLBACK\_FILTER\_NETWORK\_CONNECTION}                    = 
      17,
695         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a75199176c82c1a56e4a6bbf1cc30c12c}{LWS\_CALLBACK\_FILTER\_HTTP\_CONNECTION}                  = 18,
707         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae9734e1d7af2abf291665ce9e4a728d3}{LWS\_CALLBACK\_SERVER\_NEW\_CLIENT\_INSTANTIATED}          = 
      19,
715         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7accd8753672d319a30b4b4c2fb775e84d}{LWS\_CALLBACK\_FILTER\_PROTOCOL\_CONNECTION}                  = 
      20,
727         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae4986291b7a810fe290851d73bebeb1c}{LWS\_CALLBACK\_OPENSSL\_LOAD\_EXTRA\_CLIENT\_VERIFY\_CERTS}  
      = 21,
734         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a06006e98d27e1e884364d88317f83493}{LWS\_CALLBACK\_OPENSSL\_LOAD\_EXTRA\_SERVER\_VERIFY\_CERTS}  
      = 22,
740         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ae5ad65d779b7eab32ab67ceff91a3bac}{LWS\_CALLBACK\_OPENSSL\_PERFORM\_CLIENT\_CERT\_VERIFICATION}      
      = 23,
758         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a909cc2a7018864b0b71abacc4058fd8f}{LWS\_CALLBACK\_CLIENT\_APPEND\_HANDSHAKE\_HEADER}          = 
      24,
782         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a390da3639296660a78cc1a5dcb19037e}{LWS\_CALLBACK\_CONFIRM\_EXTENSION\_OKAY}                  = 25,
793         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a1ce5b22039ca37ee224d00047596ea46}{LWS\_CALLBACK\_CLIENT\_CONFIRM\_EXTENSION\_SUPPORTED}          
      = 26,
802         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ad5d34583e3556e153eda91620b48cc49}{LWS\_CALLBACK\_PROTOCOL\_INIT}                            = 27,
805         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a54269ca88508e6efd3afdb9d360a9caa}{LWS\_CALLBACK\_PROTOCOL\_DESTROY}                              = 28,
810         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7afd8fd77a1cc9405fcb4f26915d7f2d01}{LWS\_CALLBACK\_WSI\_CREATE}                                  = 29,
812         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aca834dc035b7f7486f9ce40fde54fe9e}{LWS\_CALLBACK\_WSI\_DESTROY}                                = 30,
814         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7adfb41c92e2522712207ef7f2462b5e34}{LWS\_CALLBACK\_GET\_THREAD\_ID}                            = 31,
819         \textcolor{comment}{/* external poll() management support */}
820         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ab69783a9fbf2ca71ad70706bda77b412}{LWS\_CALLBACK\_ADD\_POLL\_FD}                                = 32,
836         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a1df60f314710236f9b53efbf468da768}{LWS\_CALLBACK\_DEL\_POLL\_FD}                                = 33,
842         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa87d2e82fffa42c3680c7403ef94216e}{LWS\_CALLBACK\_CHANGE\_MODE\_POLL\_FD}                        = 34,
850         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a8909732521d379179003d97ab7a05428}{LWS\_CALLBACK\_LOCK\_POLL}                                    = 35,
862         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a0e9e3dd667c0c42cdbe1a3d921f4fd79}{LWS\_CALLBACK\_UNLOCK\_POLL}                                = 36,
865         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa46f705dcf97502e95627ffde614f98b}{LWS\_CALLBACK\_OPENSSL\_CONTEXT\_REQUIRES\_PRIVATE\_KEY}      
      = 37,
873         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7ac3fc5bbb55e69f90396526287ee84a51}{LWS\_CALLBACK\_WS\_PEER\_INITIATED\_CLOSE}                        = 
      38,
<<<<<<< current
882         LWS\_CALLBACK\_WS\_EXT\_DEFAULTS                            = 39,
885         LWS\_CALLBACK\_CGI                                        = 40,
887         LWS\_CALLBACK\_CGI\_TERMINATED                             = 41,
889         LWS\_CALLBACK\_CGI\_STDIN\_DATA                             = 42,
891         LWS\_CALLBACK\_CGI\_STDIN\_COMPLETED                        = 43,
893         LWS\_CALLBACK\_ESTABLISHED\_CLIENT\_HTTP                    = 44,
895         LWS\_CALLBACK\_CLOSED\_CLIENT\_HTTP                         = 45,
897         LWS\_CALLBACK\_RECEIVE\_CLIENT\_HTTP                        = 46,
899         LWS\_CALLBACK\_COMPLETED\_CLIENT\_HTTP                      = 47,
901         LWS\_CALLBACK\_RECEIVE\_CLIENT\_HTTP\_READ                   = 48,
903         LWS\_CALLBACK\_HTTP\_BIND\_PROTOCOL                         = 49,
905         LWS\_CALLBACK\_HTTP\_DROP\_PROTOCOL                         = 50,
907         LWS\_CALLBACK\_CHECK\_ACCESS\_RIGHTS                        = 51,
909         LWS\_CALLBACK\_PROCESS\_HTML                               = 52,
911         LWS\_CALLBACK\_ADD\_HEADERS                                = 53,
913         LWS\_CALLBACK\_SESSION\_INFO                               = 54,
916         LWS\_CALLBACK\_GS\_EVENT                                   = 55,
919         \textcolor{comment}{/****** add new things just above ---^ ******/}
920 
921         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a982579753e70e59a9ea13ce628ac891a}{LWS\_CALLBACK\_USER} = 1000,
923 \};
=======
876         LWS\_CALLBACK\_WS\_EXT\_DEFAULTS                            = 39,
879         LWS\_CALLBACK\_CGI                                        = 40,
881         LWS\_CALLBACK\_CGI\_TERMINATED                             = 41,
883         LWS\_CALLBACK\_CGI\_STDIN\_DATA                             = 42,
885         LWS\_CALLBACK\_CGI\_STDIN\_COMPLETED                        = 43,
887         LWS\_CALLBACK\_ESTABLISHED\_CLIENT\_HTTP                    = 44,
889         LWS\_CALLBACK\_CLOSED\_CLIENT\_HTTP                         = 45,
891         LWS\_CALLBACK\_RECEIVE\_CLIENT\_HTTP                        = 46,
893         LWS\_CALLBACK\_COMPLETED\_CLIENT\_HTTP                      = 47,
895         LWS\_CALLBACK\_RECEIVE\_CLIENT\_HTTP\_READ                   = 48,
897         LWS\_CALLBACK\_HTTP\_BIND\_PROTOCOL                         = 49,
899         LWS\_CALLBACK\_HTTP\_DROP\_PROTOCOL                         = 50,
901         LWS\_CALLBACK\_CHECK\_ACCESS\_RIGHTS                        = 51,
903         LWS\_CALLBACK\_PROCESS\_HTML                               = 52,
905         LWS\_CALLBACK\_ADD\_HEADERS                                = 53,
907         LWS\_CALLBACK\_SESSION\_INFO                               = 54,
910         LWS\_CALLBACK\_GS\_EVENT                                   = 55,
912         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7aa5cc921b7697743017a533822a3d556a}{LWS\_CALLBACK\_HTTP\_PMO}                                      = 56,
918         \textcolor{comment}{/****** add new things just above ---^ ******/}
919 
920         \hyperlink{group__usercb_ggad62860e19975ba4c4af401c3cdb6abf7a982579753e70e59a9ea13ce628ac891a}{LWS\_CALLBACK\_USER} = 1000,
922 \};
>>>>>>> patched
\end{DoxyCode}
