noisyboiler / wampy

Websocket RPC and Pub/Sub for Python applications and microservices
Mozilla Public License 2.0
127 stars 24 forks source link

Please, implement ping from client to Crossbar #72

Closed dmugtasimov closed 5 years ago

dmugtasimov commented 6 years ago

I mean WebSockets ping

noisyboiler commented 5 years ago

hi @dmugtasimov i thought i had that covered already. see https://github.com/noisyboiler/wampy/blob/master/wampy/transports/websocket/frames.py#L306

Is there a bug to report? Or do you want this exposed to be used other than by wampy internals?

thanks

dmugtasimov commented 5 years ago

No, it is not a bug report, rather a feature request. Now it is implemented to pong a ping from Crossbar. I would like also to be able to send ping from client to crossbar. And have a handler for received pong. This is needed to check if crossbar is still available (connection alive)

noisyboiler commented 5 years ago

Ok. So would a configurable websocket Ping interval be what you are after? And whatever wampy client you instantiate would Ping the router at these intervals?

dmugtasimov commented 5 years ago

I see it like I have method on wampy client which I call whenever I want and it sends ping and I have a decorator to mark a handler for pong. I this case it is up to wampy user to ping in intervals or on demand. Also pong timeout is up to wampy user to validate in handler (or outside of it).

noisyboiler commented 5 years ago

are you being disconnected from a Router then? if so, wampy does return a Pong if a Router pings you... maybe it just needs to be configured to do so?

Or if you're not being disconnected, I'm curious as to why you'd like this.

We could do it, but it needs some thought. wampy only has public APIs to send WAMP messages (no big surprise there) and exposing the websocket messages to the user is going to break the design.

noisyboiler commented 5 years ago

@dmugtasimov i gave it a go tonight: https://github.com/noisyboiler/wampy/pull/86

noisyboiler commented 5 years ago

in master.