Skip to content

Commit

Permalink
debug in websocket
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Apr 2, 2024
1 parent 8dd8699 commit 4b845bf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ws/tiny_httpd_ws.ml
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,11 @@ module Reader = struct
n
| Begin ->
read_frame_header self;
(*Log.debug (fun k ->
Log.debug (fun k ->
k "websocket: read frame of type=%s payload_len=%d"
(Frame_type.show self.header.ty)
self.header.payload_len);*)
self.header.payload_len);

(match self.header.ty with
| 0 ->
(* continuation *)
Expand All @@ -332,10 +333,12 @@ module Reader = struct
);
read_rec self buf i len
| 1 ->
(* text *)
self.state <-
Reading_frame { remaining_bytes = self.header.payload_len };
read_rec self buf i len
| 2 ->
(* binary *)
self.state <-
Reading_frame { remaining_bytes = self.header.payload_len };
read_rec self buf i len
Expand All @@ -351,7 +354,7 @@ module Reader = struct
);
0
| 9 ->
(* pong, just ignore *)
(* ping, reply *)
skip_body self;
Writer.send_pong self.writer;
read_rec self buf i len
Expand Down

0 comments on commit 4b845bf

Please sign in to comment.