Starts the background threads to listen for responses and requests from the underlying streams. Encapsulated into it's own method for future async extensions without threads.
(self)
| 29 | self.cancel = False |
| 30 | |
| 31 | def start(self): |
| 32 | """ |
| 33 | Starts the background threads to listen for responses and requests from the underlying |
| 34 | streams. Encapsulated into it's own method for future async extensions without threads. |
| 35 | """ |
| 36 | # pylint: disable=attribute-defined-outside-init |
| 37 | logger.debug('Json Rpc client started.') |
| 38 | self.request_thread = threading.Thread( |
| 39 | target=self._listen_for_request, |
| 40 | name=self.REQUEST_THREAD_NAME) |
| 41 | self.request_thread.daemon = True |
| 42 | self.request_thread.start() |
| 43 | |
| 44 | self.response_thread = threading.Thread( |
| 45 | target=self._listen_for_response, |
| 46 | name=self.RESPONSE_THREAD_NAME) |
| 47 | self.response_thread.daemon = True |
| 48 | self.response_thread.start() |
| 49 | |
| 50 | def submit_request(self, method, params, request_id=None): |
| 51 | """ |
no outgoing calls