You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: ws_handler.rs
    path of file: ./repos/cita/cita-jsonrpc/src
    
    the code of the file until where you have to start completion: // Copyright Rivtower Technologies LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::helper::{select_topic, RpcMap, TransferType};
use jsonrpc
    
    fn on_message(&mut self, msg: ws::Message) -> ws::Result<()> {
        trace!("Server got message '{}'  post thread_pool deal task ", msg);
        let tx = self.tx.clone();
        let response = Arc::clone(&self.responses);
        let sender = self.sender.clone();

        self.thread_pool.execute(move || {
            let mut req_info = RequestInfo::null();

            let _ = serde_json::from_str::<PartialRequest>(&msg.into_text().unwrap())
                .map_err(Error::from)
                .and_then(|part_req| {
                    req_info = part_req.get_info();
                    part_req.complete_and_into_proto().map(|(full_req, req)| {
                        let request_id = req.request_id.clone();
                        let topic = select_topic(&full_req.get_method());
                        let _ = tx.send((topic, req));
                        let value = (req_info.clone(), sender.clone());
                        {
                            response
                                .lock()
                                .insert(request_id, TransferType::WEBSOCKET(value));
                        }
                    })
                })
                .map_err(|err| {
                    // TODO 错误返回
                    sender.send(
                        serde_json::to_string(&RpcFailure::from_options(req_info, err)).unwrap(),
                    )
                });
        });
        //
        Ok(())
    }