ws: handle close on client quit (#6776)

pull/6785/head
Carlos Esquerdo Bernat 2020-11-08 19:36:42 +01:00 committed by GitHub
parent 3c83551dfe
commit ba366b126f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -109,6 +109,7 @@ pub fn (mut ws Client) listen() ? {
ws.logger.info('Starting client listener, server($ws.is_server)...')
defer {
ws.logger.info('Quit client listener, server($ws.is_server)...')
ws.close(1000, 'closed by client')
}
for ws.state == .open {
msg := ws.read_next_message() or {