websocket: store sub protocol value for later use in encode_and_send_ws_frame()

- the ws connection pointer can be set null if the browser closes the
  connection
- patch by Vitaliy Aleksandrov, FS#364