rawhat / mist

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

fix an issue where websocket crashes on internal control closeframe #25

Closed eliknebel closed 9 months ago

eliknebel commented 9 months ago

Potentially fixes an issue where websocket crashes on internal control closeframe.

The assertion being made in src/mist/internal/websocket.gleam:232 crashes a webserver using mist websockets when the call returns an error.

This fix appears to conform to the patterns in other case clauses, where there is no assertion made to the result from connection.transport.send. Given a better understanding of the purpose of this function however, there may be a better way to approach this.

Closes #24

rawhat commented 9 months ago

I think to your point about the other methods... we should probably attempt to bubble that up to the caller. For this one, however, if the socket receives a close frame, I'm fairly certain the client is going to close regardless.

I'll need to (re-)check the spec, but I believe it's not expected to necessarily expect it to complete. Either way, this one looks correct to me.

Thank you!

rawhat commented 9 months ago

Do you mind adding an entry to the CHANGELOG please? Then I can get this merged in :)

eliknebel commented 9 months ago

Do you mind adding an entry to the CHANGELOG please? Then I can get this merged in :)

Sure thing!

rawhat commented 9 months ago

Awesome, thank you!