rawhat / mist

gleam HTTP server. because it glistens on a web
Apache License 2.0
333 stars 12 forks source link

Ping control frames never parsed #20

Closed arnarg closed 1 year ago

arnarg commented 1 year ago

I'm getting the following errors with a long running websocket connection.

=ERROR REPORT==== 7-Jun-2023::09:13:17.031402 ===
Error in process <0.123.0> with exit value:
{{case_clause,9},
 [{mist@internal@websocket,frame_from_message,3,
                           [{file,"/home/arnar/Code/gliew/build/dev/erlang/mist/_gleam_artefacts/mist@internal@websocket.erl"},
                            {line,154}]},
  {mist@internal@handler,handle_websocket_message,3,
                         [{file,"/home/arnar/Code/gliew/build/dev/erlang/mist/_gleam_artefacts/mist@internal@handler.erl"},
                          {line,28}]},
  {glisten@handler,'-start/1-fun-3-',3,
                   [{file,"/home/arnar/Code/gliew/build/dev/erlang/glisten/_gleam_artefacts/glisten@handler.erl"},
                    {line,169}]},
  {gleam@otp@actor,loop,1,
                   [{file,"/home/arnar/Code/gliew/build/dev/erlang/gleam_otp/_gleam_artefacts/gleam@otp@actor.erl"},
                    {line,137}]}]}

Which I have traced to https://github.com/rawhat/mist/blob/v0.11.0/src/mist/internal/websocket.gleam#L63 as it's not matching opcode 9 afaict.

Here it's expecting it as a possible output from frame_from_message but if I'm not mistaken this will never happen.

rawhat commented 1 year ago

Huh, yeah that does seem like it needs to be handled. Just an oversight on my part, I'm sure. I can look into that. Thank you!

rawhat commented 1 year ago

This should be good now. It did also uncover a few things I'm doing incorrectly per the RFC, but I'm going to tackle those separately.

Thanks for catching this 😄

arnarg commented 1 year ago

Perfect! Thanks! 🎉