Skip to content
Snippets Groups Projects
Commit 4103e614 authored by inso's avatar inso
Browse files

Handle autoping and autoclose parameters

parent e8190277
No related branches found
No related tags found
No related merge requests found
...@@ -184,7 +184,7 @@ class API(object): ...@@ -184,7 +184,7 @@ class API(object):
response = await aiohttp.post(self.reverse_url("http", path), data=kwargs, headers=self.headers) response = await aiohttp.post(self.reverse_url("http", path), data=kwargs, headers=self.headers)
return response return response
def connect_ws(self, path): def connect_ws(self, path, autoping=True, autoclose=True):
""" """
Connect to a websocket in order to use API parameters Connect to a websocket in order to use API parameters
...@@ -192,7 +192,7 @@ class API(object): ...@@ -192,7 +192,7 @@ class API(object):
:return: :return:
""" """
url = self.reverse_url("ws", path) url = self.reverse_url("ws", path)
return aiohttp.ws_connect(url) return aiohttp.ws_connect(url, autoping=autoping, autoclose=autoclose)
from . import network, blockchain, tx, wot, node, ud, ws from . import network, blockchain, tx, wot, node, ud, ws
...@@ -32,8 +32,8 @@ class Block(Websocket): ...@@ -32,8 +32,8 @@ class Block(Websocket):
"""Connect to block websocket.""" """Connect to block websocket."""
schema = _Block.schema schema = _Block.schema
def connect(self): def connect(self, autoping=True, autoclose=True):
r = self.connect_ws('/block') r = self.connect_ws('/block', autoping=autoping, autoclose=autoclose)
return r return r
...@@ -64,6 +64,6 @@ class Peer(Websocket): ...@@ -64,6 +64,6 @@ class Peer(Websocket):
"required": ["version", "currency", "pubkey", "endpoints", "signature"] "required": ["version", "currency", "pubkey", "endpoints", "signature"]
} }
def connect(self): def connect(self, autoping=True, autoclose=True):
r = self.connect_ws('/peer') r = self.connect_ws('/peer', autoping=autoping, autoclose=autoclose)
return r return r
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment