diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index fa5e61e888bde082f006b463d016ababb629e7d1..fff2bc366cdb43cbbb7445b10add8460e8c84832 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -1309,6 +1309,16 @@ lws_get_fops(struct lws_context *context)
 	return &context->fops;
 }
 
+/**
+ * lws_get_context - Allow geting lws_context from a Websocket connection
+ * instance
+ *
+ * With this function, users can access context in the callback function.
+ * Otherwise users may have to declare context as a global variable.
+ *
+ * @wsi:	Websocket connection instance
+ */
+
 LWS_VISIBLE LWS_EXTERN struct lws_context *
 lws_get_context(const struct lws *wsi)
 {
diff --git a/libwebsockets-api-doc.html b/libwebsockets-api-doc.html
index 80ccd3769bb5069de5d1b1ca087830165a441729..ee1137127e9c3a49a6fc43dad4640d06c43cc405 100644
--- a/libwebsockets-api-doc.html
+++ b/libwebsockets-api-doc.html
@@ -545,6 +545,22 @@ This is never set at the start of a writeable callback, but any write
 may set it.
 </blockquote>
 <hr>
+<h2>lws_get_context - Allow geting lws_context from a Websocket connection instance</h2>
+<i>LWS_EXTERN struct lws_context *</i>
+<b>lws_get_context</b>
+(<i>const struct lws *</i> <b>wsi</b>)
+<h3>Arguments</h3>
+<dl>
+<dt><b>wsi</b>
+<dd>Websocket connection instance
+</dl>
+<h3>Description</h3>
+<blockquote>
+<p>
+With this function, users can access context in the callback function.
+Otherwise users may have to declare context as a global variable.
+</blockquote>
+<hr>
 <h2>lws_parse_uri - </h2>
 <i>LWS_EXTERN int</i>
 <b>lws_parse_uri</b>