Jelajahi Sumber

Sending MG_WEBSOCKET_CLOSE

Sergey Lyubka 12 tahun lalu
induk
melakukan
25863b59a6
2 mengubah file dengan 2 tambahan dan 1 penghapusan
  1. 1 0
      mongoose.c
  2. 1 1
      mongoose.h

+ 1 - 0
mongoose.c

@@ -3710,6 +3710,7 @@ static void handle_websocket_request(struct mg_connection *conn) {
     send_websocket_handshake(conn);
     send_websocket_handshake(conn);
     call_user(conn, MG_WEBSOCKET_READY);
     call_user(conn, MG_WEBSOCKET_READY);
     read_websocket(conn);
     read_websocket(conn);
+    call_user(conn, MG_WEBSOCKET_CLOSE);
   }
   }
 }
 }
 
 

+ 1 - 1
mongoose.h

@@ -62,7 +62,7 @@ enum mg_event {
                         // with handshake, otherwise it closes the connection.
                         // with handshake, otherwise it closes the connection.
   MG_WEBSOCKET_READY,   // Handshake has been successfully completed.
   MG_WEBSOCKET_READY,   // Handshake has been successfully completed.
   MG_WEBSOCKET_MESSAGE, // Incoming message from the client
   MG_WEBSOCKET_MESSAGE, // Incoming message from the client
-  MG_WEBSOCKET_CLOSE,   // Client has sent FIN frame
+  MG_WEBSOCKET_CLOSE,   // Client has closed the connection
 };
 };