Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ping handling #50

Closed
fnordian opened this issue Nov 12, 2017 · 6 comments
Closed

ping handling #50

fnordian opened this issue Nov 12, 2017 · 6 comments

Comments

@fnordian
Copy link
Contributor

Hi!

Creating and starting a long running client leads to disconnects due to unhandled pings from the router.

with wampy.Client(url="ws://localhost:8080/ws") as client:
    client.publish(topic="test", foo="bar")
    time.sleep(10)
    client.publish(topic="test", foo="bar")
 Traceback (most recent call last):
  File "/home/marcus/local/python/python3env/lib/python3.6/site-packages/wampy/transports/websocket/frames.py", line 253, in __init__
    self.payload = json.loads(self.body.decode('utf-8'))
  File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.6/json/decoder.py", line 342, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 2 (char 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/marcus/local/python/python3env/lib/python3.6/site-packages/eventlet/hubs/poll.py", line 114, in wait
    listener.cb(fileno)
  File "/home/marcus/local/python/python3env/lib/python3.6/site-packages/eventlet/greenthread.py", line 218, in main
    result = function(*args, **kwargs)
  File "/home/marcus/local/python/python3env/lib/python3.6/site-packages/wampy/session.py", line 158, in connection_handler
    frame = connection.receive()
  File "/home/marcus/local/python/python3env/lib/python3.6/site-packages/wampy/transports/websocket/connection.py", line 86, in receive
    frame = ServerFrame(received_bytes)
  File "/home/marcus/local/python/python3env/lib/python3.6/site-packages/wampy/transports/websocket/frames.py", line 256, in __init__
    'Failed to load JSON object from: "%s"', self.body
wampy.errors.WebsocktProtocolError: ('Failed to load JSON object from: "%s"', bytearray(b'6xLI'))
Removing descriptor: 3

Are there plans to add ping-handling?

@fnordian
Copy link
Contributor Author

Please consider merging #51

@noisyboiler
Copy link
Owner

Thanks for this @fnordian
Is this similar to the heartbeat in AMQP? I wasn't aware of the pings from the router.

@fnordian
Copy link
Contributor Author

They seem to have the same intention. But I am not familiar with the amqp protocol. In the wamp-case, detection of stale tcp-connections happens in the websocket-layer, not the wamp-layer.

@noisyboiler
Copy link
Owner

sorted. see #51

@noisyboiler
Copy link
Owner

@fnordian
Copy link
Contributor Author

Cool. You're welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants