--- a/src/websocket.c
+++ b/src/websocket.c
@@ -25,6 +25,7 @@
 #ifdef HAVE_PTHREAD_NP_H
 # include <pthread_np.h>
 #endif
+#include <errno.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <string.h>